【文件属性】:
文件名称:来回流水灯程序
文件大小:493B
文件格式:C
更新时间:2016-05-06 08:40:20
小灯左右循环
#include
typedef unsigned char uint8;
typedef unsigned int uint16;
sbit ENLED = P1^4;
sbit ADDR0 = P1^0;
sbit ADDR1 = P1^1;
sbit ADDR2 = P1^2;
sbit ADDR3 = P1^3;
main()
{
uint16 i;
uint8 j;
ENLED = 0;
ADDR0 = 0; ADDR1 = 1; ADDR2 = 1; ADDR3 = 1;
while (1)
{
while(j<7)
{
P0 = ~(1<>j++);
for (i=0;i<2500;i++);
}
j = 0;
}
}