
#include
void
tst_crol
(void)
{
char
a
char
b
a
=
0xA5
b
=
_crol_(a,3)
/*
b
now
is
0x2D
*/
}
你可以在你安装Keil的目录下找搏洞D:\Keil\基败枯C51\HLP内的C51lib.chm中有枯铅
delay()函数中第二个for循环中,j值最大只能是32768,永远都满足j<100000这个条件,也就是永远都跳不出这个循环,程序执行到这里以后就无法执行后面的语句了。a=(a<<1)|0x01;这条语句也有错误。
以下流水灯的程序你可以参考:
#include<改衡脊reg51.h>
#include <intrins.h>
void delayms(unsigned char ms)
// 延时子程序
{
unsigned char i
while(ms--)
{
for(i = 0i <120i++)
}
}
main()
{
unsigned char LED
LED = 0xfe
P0 = LED
while(1)
{
delayms(250)
LED = _crol_(LED,1)//循环核渗右移1位,点拦袭亮下一个LED
P0 = LED
}
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)