第五章 Keil C51库函数参考 C51强大功能及其高效率的重要体现之一在于其丰富的可直接调用的库函数,多使用库函数使程序代码简单,结构清晰,易于调试和维护,下面介绍C51的库函数系统。 1. 第一节 本征库函数(intrinsic routines)和非本征证库函数 C51提供的本征函数是指编译时直接将固定的代码插入当前行,而不是用ACALL和LCALL语句来实现,这样就大大提供了函数访问的效率,而非本征函数则必须由ACALL及LCALL调用。 C51的本征库函数只有9个,数目虽少,但都非常有用,列如下: _crol_,_cror_:将char型变量循环向左(右)移动指定位数后返回 _iror_,_irol_:将int型变量循环向左(右)移动指定位数后返回 _lrol_,_lror_:将long型变量循环向左(右)移动指定位数后返回 _nop_: 相当于插入NOP _testbit_: 相当于JBC bitvar测试该位变量并跳转同时清除。 _chkfloat_: 测试并返回源点数状态。 使用时,必须包含#inclucle 一行。 如不说明,下面谈到的库函数均指非本征库函数
上传时间: 2013-10-19
上传用户:1184599859
为解决我国水位监测野外条件下长期无人看守的问题,研制开发了基于MSP430单片机的智能水位计。从其组成到各功能分别进行了详细的介绍,该智能水位计不仅实现了水位数据的实时监测、记录和定期采集等多种工作模式,而且提高了水位监测精度,实现了水位监测的智能化。 Abstract: In order to solve the problems of long-term unmanned observation in the field water monitoring,an intelligence water-level meter based on MSP430 is developed composition and every function moduce of the water level meter was introduced in detail. It not only realizes water level data collection and storage, regularly gathering and so on, but also improves the water-level precision , finally realizes the intelligence.
上传时间: 2013-11-17
上传用户:417313137
生活中许多目标的高度和水平距离需要进行测量。目前主要的测量方法,仍以传统的皮尺丈量为主,测量效率不高,有时还很不方便,没有技术成熟的数字式测高测距产品。以基本的数学方法为理论依据,利用遥控小车做为载体,采用角度传感器测量角度、霍尔传感器测量水平距离等,通过单片机LM3S615进行数据计算,实现了对待测目标物体的高度、水平距离等数据的快速、精确和数字式的测量,高度测量精度可达99.06%,水平测量精度则可达98.06%。 Abstract: In our lives, the height and horizontal distance of some goals are needed to be measured. Because the currently used methods are still traditional tape-based measuring methods, and the measuring efficiency is low and inconvenient so some kinds of digital and portable measuring methods or instruments are needed. Based on the basic math theory, this paper designed and manufactured a portable, digital and remote controlled measuring mobile small vehicle, which assembled with angle measuring sensor for angle measurement and Hall sensor for horizontal distance measuring. MCU LM3S615 calculated the height and horizontal distance data gotten from these sensors. The measuring process is simple, the measuring results are more accurate and the measuring efficiency is higher than traditional measure instruments. The accuracy of height and distance measurement can reach 99.06% and 98.06%.
上传时间: 2013-10-30
上传用户:jackandlee
针对众多低成本数据采集需求,采用带有片上USB控制器和D/A转换器的混合信号微处理器C8051F340,设计了一款可通过USB接口和LabVIEW图形用户界面实现与PC机联机的数据采集器,同时借助系统的SD卡存储独立实现现场长时间采集数据。该数据采集器成本低,结构简单,体积小,已成功用于工业现场。 Abstract: Aiming at the need of low cost data acquisition, a data acquisition device is designed based on C8051F340 which is a mixed-signal microcontroller and integrates USB controller and A/D controller on a chip.The data acquisition device which can combine with PC by USB interface and LabVIEW graphical user interface,can realize data acquisition. At the same time,it can be solely run a long time in virtue of SD card in field.The date aequisition device features low cost,simple structure and little sharp, and it has been used in industry field.
上传时间: 2014-05-31
上传用户:1109003457
基于幅移键控技术ASK(Amplitude-Shift Keying),以C8051F340单片机作为监测终端控制器,C8051F330D单片机作为探测节点控制器,采用半双工的通信方式,通过监控终端和探测节点的无线收发电路,实现数据的双向无线传输。收发电路采用直径为0.8 mm的漆包线自行绕制成圆形空心线圈天线,天线直径为(3.4±0.3)cm。试验表明,探测节点与监测终端的通信距离为24 cm,通过桥接方式,节点收发功率为102 mW时,节点间的通信距离可达20 cm。与传统无线收发模块相比,该无线收发电路在受体积、功耗、成本限制的场合有广阔的应用前景。 Abstract: Based on ASK technology and with the C8051F340 and C8051F330D MCU as the controller, using half-duplex communication mode, this paper achieves bi-directional data transfer. Transceiver circuit constituted by enameled wire which diameter is 0.8mm and wound into a diameter (3.4±0.3) cm circular hollow coil antenna. Tests show that the communication distance between detection and monitoring of the terminal is 24cm,the distance is up to 20cm between two nodes when using the manner of bridging and the node transceiver power is 102mW. Compared with the conventional wireless transceiver modules, the circuit has wide application prospect in small size, low cost and low power consumption and other characteristics.
上传时间: 2013-10-19
上传用户:xz85592677
The SN65LBC170 and SN75LBC170 aremonolithic integrated circuits designed forbidirectional data communication on multipointbus-transmission lines. Potential applicationsinclude serial or parallel data transmission, cabledperipheral buses with twin axial, ribbon, ortwisted-pair cabling. These devices are suitablefor FAST-20 SCSI and can transmit or receivedata pulses as short as 25 ns, with skew lessthan 3 ns.These devices combine three 3-state differentialline drivers and three differential input linereceivers, all of which operate from a single 5-Vpower supply.The driver differential outputs and the receiverdifferential inputs are connected internally to formthree differential input/output (I/O) bus ports thatare designed to offer minimum loading to the buswhenever the driver is disabled or VCC = 0. Theseports feature a wide common-mode voltage rangemaking the device suitable for party-lineapplications over long cable runs.
上传时间: 2013-10-13
上传用户:ytulpx
LLCR Pin Socket Testing with the Model 3732 High Density Matrix Card Computer processors (CPUs) today have come a long way from the computer processors of the past. They draw more power, run at lower voltages, and have more pins than ever before.
上传时间: 2013-10-24
上传用户:whenfly
C51 中的关键字关键字 用途 说明auto 存储种类说明 用以说明局部变量,缺省值为此break 程序语句 退出最内层循环case 程序语句 Switch 语句中的选择项char 数据类型说明 单字节整型数或字符型数据const 存储类型说明 在程序执行过程中不可更改的常量值continue 程序语句 转向下一次循环default 程序语句 Switch 语句中的失败选择项do 程序语句 构成do..while 循环结构double 数据类型说明 双精度浮点数else 程序语句 构成if..else 选择结构enum 数据类型说明 枚举extern 存储种类说明 在其他程序模块中说明了的全局变量flost 数据类型说明 单精度浮点数for 程序语句 构成for 循环结构goto 程序语句 构成goto 转移结构if 程序语句 构成if..else 选择结构int 数据类型说明 基本整型数long 数据类型说明 长整型数register 存储种类说明 使用CPU 内部寄存的变量return 程序语句 函数返回short 数据类型说明 短整型数signed 数据类型说明 有符号数,二进制数据的最高位为符号位sizeof 运算符 计算表达式或数据类型的字节数static 存储种类说明 静态变量struct 数据类型说明 结构类型数据swicth 程序语句 构成switch 选择结构typedef 数据类型说明 重新进行数据类型定义union 数据类型说明 联合类型数据unsigned 数据类型说明 无符号数数据void 数据类型说明 无类型数据volatile 数据类型说明 该变量在程序执行中可被隐含地改变while 程序语句 构成while 和do..while 循环结构ANSIC 标准关键字关键字 用途 说明bit 位标量声明 声明一个位标量或位类型的函数sbit 位标量声明 声明一个可位寻址变量
标签: C51
上传时间: 2013-10-08
上传用户:waves_0801
汇编器在微处理器的验证和应用中举足轻重,如何设计通用的汇编器一直是研究的热点之一。本文提出了一种开放式的汇编器系统设计思想,在汇编语言与机器语言间插入中间代码CMDL(code mapping description language)语言,打破汇编语言与机器语言的直接映射关系,由此建立起一套描述汇编语言与机器语言的开放式映射体系。基于此开放式映射体系开发了一套汇编器系统,具有较高层次上的通用性和可移植性。【关键词】指令集,CMDL,汇编器,开放式 Design of Retargetable Assembler System Liu Ling Feng Wen Nan Wang Ying Chun Jiang An Ping Ji Li Jiu IME of Peking University, 100871【摘要】An assembler plays a very important role in the field of microprocessor verifications and applications, thus how to build a retargetable assembler system has been a hotspot in this field for long time. This paper presents a new method about the retargetable assembler system design.It provides a kind of language CMDL, code mapping description language. During the process of assembling, assembler languages are firstly translated to CMDL, and then mapped to the machine codes. In an other word, CMDL is inserted between assembler languages and machine codes during the translation procedure. As a medium code, CMDL has a lot of features, such as high extraction, strong descript capabilities. It can describe almost all attributes of assembler languages. By breaking the direct mapping relationship between assembler languages and machine codes, the complexities of machine codes are hided to the users, therefore, the new retargetable assembler system has higher retargetable level by converting the mapping from assembler languages and machine codes to assembler languages and CMDL, and implementationof it becomes easier. Based on the new mapping system structure, a retargetable assemblersystem is developed. It proved the whole system has good retargetability and implantability.【关键词】instruction set, symbol table, assembler, lexical analysis, retargetability
上传时间: 2013-10-10
上传用户:meiguiweishi
keil 使用笔记:在Memory窗口上输入address_type:address才能看到正确地址的变量debug~perfermance analyzer加入要察看的模块名称,然后view~perfermance analyzer window 可以察看各个模块运行时间①Display address_type:address B:Bit address C:Code Memory Bx:Code Bank D D:80H 命令可以查看特殊寄存器 data D I:0 命令可以查看内部RAM数据iData; D X:0 命令可以查看外部RAM数据xData; ②R1 //显示R1 register ~R1 //显示变量R1 R1 = R7 //对寄存器Rx操作R1 = --R7 R1 = 0x20 ③main //显示main()的开始地址d main //显示main()的代码④向RAM.ROM中写数据Enter data_type address_type:address expr,expr.... data_type:int char double float long E char data:0x20 1,2,3,4 //向data区0x20开始的地址写1,2,3,4 变量放在RAM的30H,要把定义放在main前面!另外特别注意,内部RAM通常供C程序存放中间变量等,所以一定要看看编译后的程序中是否存在存储单元冲突的情况,比如如果程序中 使用了别的寄存器组的话,08-1FH单元就不能用了unsigned long data i _at_ 0x30
上传时间: 2013-11-05
上传用户:dongqiangqiang