uc/OSII 任务切换
摘要:代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1interrupt1voidOSCtxSw(void)//swi软中断2{3//PSHH//编译器自动加上45//将当前栈指针压栈//压栈的顺序:PCL,PCH,X,A,CCRandH67//将当...
阅读全文
MC9S08中断机制
摘要:When an interrupt is requested, the CPU completes the current instruction before responding to theinterrupt. At this point, the program counter is pointing at the start of the next instruction, which ...
阅读全文
Keil和Porteus的联合调试
摘要:以下方法在Proteus 6.7 SP3+Keil7.50a测试通过1.把压缩文件中的VDM51.DLL解压到Keil目录下的c51\BIN 2.修改Keil目录下的TOOLS.ini文件,加入“TDRV5=BIN\VDM51.dll ("Proteus Debug")”一项,如下:[C51]...TDRV0=BIN\MON51.DLL ("Keil Monitor-51 Driver")TDRV...
阅读全文
外部中断实验
摘要:/*手动外部输入中断后熄灭发光二级管*/#include void service_int0() interrupt 0 using 2{ P1_0=1; //发光二级管灭} void main(){ EA=1; //中断总允许 IT0=1; //后沿负跳有效 EX0=1; //允许外部中断 P1_0=0; //发光二级管开 do{}while(P1_0==0); do{...
阅读全文
定时器实验
摘要:6M晶振的条件下,用定时器产生100ms定时,由P1_0输出周期为200ms的方波信号。T0工作在方式1,即16位定时器/计数器方式。Keil程序如下:#include void main(){TMOD=0x01; //工作方式1,即是:16位定时/计数器TR0=1; //启动计数器for(;;){TH0=0x3D; //8位特殊功能寄存器TL0=0xB0;do{}while(TF0==0); /...
阅读全文
C51最小系统
摘要:测试程序:#include void main(void) //主函数名{unsigned int a; //定义变量a为int类型 do{ //do while组成循环for(a=0;a<30000;a++); //这是一个循环P1_0=0; //设P1.0口为低电平,点亮LEDfor (a=0;a<30000;a++); //这是一个循环P1_0=1; //设P1.0口为高电平,熄灭LED}...
阅读全文