《初学者C51自学笔记》之流水灯实现(总线操作)
2022-02-17 来源:eefocus
#include #define uchar unsigned char //宏定义 #define uint unsigned int unsigned char table[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//11111110,11111101,11111011..... /* 延时 */ void delay(void) { uchar a,b; for(a=0;a<200;a++) for(b=0;b<200;b++); } void main() { uchar i; while(1) { for(i=0;i<8;i++) { P0=table[i]; delay(); } } }
相关文章