博客
关于我
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了。

你可能感兴趣的文章
NO.23 ZenTaoPHP目录结构
查看>>
no1
查看>>
NO32 网络层次及OSI7层模型--TCP三次握手四次断开--子网划分
查看>>
NOAA(美国海洋和大气管理局)气象数据获取与POI点数据获取
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
node
查看>>
node exporter完整版
查看>>
node HelloWorld入门篇
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node JS: < 二> Node JS例子解析
查看>>
Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime(93)解决
查看>>
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime(72)
查看>>
Node 裁切图片的方法
查看>>
node+express+mysql 实现登陆注册
查看>>
Node+Express连接mysql实现增删改查
查看>>
node, nvm, npm,pnpm,以前简单的前端环境为什么越来越复杂
查看>>
Node-RED中Button按钮组件和TextInput文字输入组件的使用
查看>>
vue3+Ts 项目打包时报错 ‘reactive‘is declared but its value is never read.及解决方法
查看>>
Node-RED中Slider滑杆和Numeric数值输入组件的使用
查看>>
Node-RED中Switch开关和Dropdown选择组件的使用
查看>>