1.Keil C内部延时函数直接调用库函数:
#include<intrins.h> // 声明了void _nop_(void);
_nop_(); // 产生一条NOP指令
NOP指令为单周期指令
//
2.keil C中定义bit变量是有上限的,
查询资料是128个,实际使用时确实遇到过这个问题,多一个变量则编译器则会报错
解决办法:将bit 定义为 char
//
3.Keil C的data,xdata区别
data:内部低128字节RAM,可高速寻址
Xdata:外部扩展RAM,寻址速度较慢
PS:优先使用data,因为速度快,代码空间少( keil中定义变量时使用 idata unsigned char)
//
4.Keil C常量数组的定义(汇编理解的表格)
共2种方式:
const unsigned char tab[] = { };
数组为只读,存放在RAM中;
code unsigned char tab[] = { };
数组为只读,存放在ROM中;
//
共7条
1/1 1 跳转至页
总结一些Keil IDE使用下的心得和遇到过的坑

关键词: keil 坑 BUG 总结

我也来补充补充~ Startup code is executed immediately upon reset of the target system. The Keil startup code performs (optionally) the following operations in order: 启动代码是单片机复位后最先执行的代码,keil 中的启动代码通常按顺序 完成以下操作 • Clears internal data memory (清空内部数据内存) • Clears external data memory (清空外部数据内存) • Clears paged external data memory (清空分页的外部数据内存) • Initializes the small model reentrant stack and pointer (初始化小模型可重入栈和指针) • Initializes the large model reentrant stack and pointer • Initializes the compact model reentrant stack and pointer • Initializes the 8051 hardware stack pointer 初始化8051硬件栈指针 • Transfers control to code that initializes global variables or to the main C function if there are no initialized global variables 将控制权交给全局变量初始代码段,或者如果没有全局代码初始段时交给c语言的main 函数 Following is a list of the startup files that are available. (keil 中可用的启动代码文件) Startup File Description STARTUP.A51 Startup code for classic 8051 devices. (这个就是8051系列的启动代码文件了) START_AD.A51 Startup code for Analog Devices MicroConverter devices. START390.A51 Startup code for Dallas DS80C390/400/41x/5240/5250 contiguous mode devices. START4XX.A51 Startup code for Dallas DS89C420/430/440/450 devices. STARTLPC.A51 Startup code for NXP LPC700 devices series. START900.A51 Startup code for NXP LPC90x - LPC93x devices series. START950.A51 Startup code for NXP LPC95x - LPC99x devices series. START_MX.A51 Startup code for NXP 80C51MX devices. START751.A51 Startup code for NXP 80C75x devices. START_XC.A51 Startup code for Infineon XC800 devices. STARTUP32.A51 Startup code for ST uPSD32xx devices. STARTUP34.A51 Startup code for ST uPSD33xx devices. STARTUP34.A51 Startup code for ST uPSD34xx devices. Copy the appropriate startup file from the \KEIL\C51\LIB\ folder into your project folder and make any changes to the copy. Each startup file provides assembly constants you may change to control the operations performed at startup. 启动代码文件位于 \KEIL\C51\LIB\ , 你可以通过修改启动代码文件里的如下常量来匹配自己的程序 2、keil c51 拓展关键字 To facilitate many of the features of the 8051, the Cx51 Compiler adds a number of new keywords to the scope of the C language: 为了帮助8051实现某些功能,CX51编译器增加了在C语言范围内的一系列关键词。 • _at_ • alien • bdata • bit • code • compact • data • far • idata • interrupt • large • pdata • _priority_ • reentrant • sbit • sfr • sfr16 • small • _task_ • using • xdata |
共7条
1/1 1 跳转至页
回复
打赏帖 | |
---|---|
嵌入式LinuxC语言程序调试和宏使用技巧被打赏50分 | |
让代码中包含最新的编译时间信息被打赏50分 | |
【分享开发笔记,赚取电动螺丝刀】STM32F769LVGL优化显示被打赏26分 | |
rtthread硬件加密--2crc加密分析被打赏10分 | |
【分享开发笔记,赚取电动螺丝刀】STM32F769驱动ST7789以及显示优化被打赏36分 | |
【分享开发笔记,赚取电动螺丝刀】S32K146 PAL模拟I2C驱动适配被打赏23分 | |
我想要一部加热台+电源硬件设计规范被打赏16分 | |
我想要一部加热台+LED背光驱动芯片RT9293知识被打赏18分 | |
【分享开发笔记,赚取电动螺丝刀】S32K146 ADC 模块配置使用被打赏24分 | |
【换取手持数字示波器】nRF54L15-DK开发环境搭建被打赏31分 |