博客
关于我
Keil 下生成LIB库文件以及如何使用LIB库文件
阅读量:152 次
发布时间:2019-02-27

本文共 2026 字,大约阅读时间需要 6 分钟。

Keil 下生成LIB库文件以及如何使用LIB库文件

如何生成LIB库文件?

1.   首先准备好生成LIB库文件对应的.c和.h文件,我这里用到的.c和.h文件分别是:

commLib.h:

 

/*======================================================*//* 延时函数,单位ms										*//* 晶振频率为11.0592MHz时延时1ms子程序 					*//*======================================================*/void delay(int ms);/*======================================================*//* 循环左移函数	2015年7月27日 21:34:44			 		*//*======================================================*/unsigned char ccCrol(unsigned char org, unsigned char bitNum);/*======================================================*//* 循环右移函数	2015年7月29日 21:40:39		 			*//*======================================================*/unsigned char ccCror(unsigned char org, unsigned char bitNum);

 

commLib.c:

 

/*======================================================*//* 延时函数,单位ms										*//* 晶振频率为11.0592MHz时延时1ms子程序 					*//*======================================================*/void delay(int ms){	int i, j;	for (i = ms; i > 0; i--)	{		for (j = 110; j > 0; j--)		{		}	}}/*======================================================*//* 循环左移函数	2015年7月27日 21:34:44		 			*//*======================================================*/unsigned char ccCrol(unsigned char org, unsigned char bitNum){	unsigned char i;	unsigned char high, low;	unsigned char after = org;		for (i = 0; i < bitNum; i++)	{		high = after & 0x80;		low = high >> 0x07;		after <<= 0x01;		after |= low;	}		return after;}/*======================================================*//* 循环右移函数	2015年7月29日 21:40:39		 			*//*======================================================*/unsigned char ccCror(unsigned char org, unsigned char bitNum){	unsigned char i;	unsigned char high, low;	unsigned char after = org;		for (i = 0; i < bitNum; i++)	{		low = after & 0x01;		high = low << 0x07;		after >>= 0x01;		after |= high;	}		return after;}

 

 

2.        新建一个项目,将这两个文件添加到袄项目中,并做以下设置:

选中Create Library

 

 

 

3.        编译之后就可在项目目录下生成对应的.LIB库文件了。

 

 

 

如何使用LIB库文件呢?

1.        新建一个项目,然后在你的项目中包含LIB库文件对应的头文件commLib.h。

如图:

 

2.        添加LIB库文件到项目中:

 

然后选择你要添加的LIB库文件:

 

 

添加完成之后就可以在项目中看到对应的库文件了:

 

3.        编译项目就OK了。

你可能感兴趣的文章
mysql 里对root及普通用户赋权及更改密码的一些命令
查看>>
Mysql 重置自增列的开始序号
查看>>
mysql 锁机制 mvcc_Mysql性能优化-事务、锁和MVCC
查看>>
MySQL 错误
查看>>
mysql 随机数 rand使用
查看>>
MySQL 面试题汇总
查看>>
MySQL 面试,必须掌握的 8 大核心点
查看>>
MySQL 高可用性之keepalived+mysql双主
查看>>
MySQL 高性能优化规范建议
查看>>
mysql 默认事务隔离级别下锁分析
查看>>
Mysql--逻辑架构
查看>>
MySql-2019-4-21-复习
查看>>
mysql-5.6.17-win32免安装版配置
查看>>
mysql-5.7.18安装
查看>>
MySQL-Buffer的应用
查看>>
mysql-cluster 安装篇(1)---简介
查看>>
mysql-connector-java.jar乱码,最新版mysql-connector-java-8.0.15.jar,如何愉快的进行JDBC操作...
查看>>
mysql-connector-java各种版本下载地址
查看>>
mysql-EXPLAIN
查看>>
MySQL-Explain的详解
查看>>