标签:
#include <reg52.h> #define uchar unsigned char #define uint unsigned int uint table[] = {0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f}; void delay(void) { uint a = 50000; while(a--); } void main() { int i = 0; while(1) { for(i = 0; i < 8; i++) { P0 = table[i]; delay(); } for(i = 7; i >= 0; i--) { P0 = table[i]; delay(); } } }
其实学单片机也是看林峰的视频的:《林峰带你征服嵌入式》!直接上代码吧。
标签:
原文地址:http://blog.csdn.net/zhang5476499/article/details/45559133