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

你可能感兴趣的文章
NLTK - 停用词下载
查看>>
nmap 使用总结
查看>>
nmap 使用方法详细介绍
查看>>
nmap使用
查看>>
nmap使用实战(附nmap安装包)
查看>>
Nmap哪些想不到的姿势
查看>>
Nmap扫描教程之Nmap基础知识
查看>>
nmap指纹识别要点以及又快又准之方法
查看>>
Nmap渗透测试指南之指纹识别与探测、伺机而动
查看>>
Nmap端口扫描工具Windows安装和命令大全(非常详细)零基础入门到精通,收藏这篇就够了
查看>>
NMAP网络扫描工具的安装与使用
查看>>
NMF(非负矩阵分解)
查看>>
nmon_x86_64_centos7工具如何使用
查看>>
NN&DL4.1 Deep L-layer neural network简介
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.7 Parameters vs Hyperparameters
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
nnU-Net 终极指南
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>