f=20; ms=0; while(1) {while(ms<25); ms=0; asm(" RSBX XF "); while(ms<25); ms=0; asm(" SSBX XF "); } f,ms是两个变量,ms是在定时器中断中没中断一次增加1,XF控制LED闪烁,上面这个程序不行,改为下面这样就可以,真是很奇怪. f=20; ms=0; while(1) {while(ms<500/f); ms=0; asm(" RSBX XF "); while(ms<500/f); ms=0; asm(" SSBX XF "); }
|