51单片机源程序:
- #include <reg52.h>
- #define uchar unsigned char
- #define uint unsigned int
- uchar code Pattern_P0[]=
- {
- 0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xfe,0xfb,0xef,0xbf,0xfd,0xf7,0xdf,0x7f,0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,0xff
- };
- //0xfc,0xf9,0xf3,0xe7,0xcf,0x9f
- uchar code Pattern_P2[]=
- {
- 0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xfe,0xfb,0xef,0xbf,0xfd,0xf7,0xdf,0x7f,0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,0xff
- };
- // 0xf5,0xf6,0xfe,0x54,0x56,0x76,0xd7,0x49,0xa9,0xe4,0xc6
- void DelayMS(uint x)
- {
- uchar t;
- while(x--)
- {
- for(t=120;t>0;t--);
- }
- }
- void main()
- {
- uchar i;
- while(1)
- {
- for(i=0;i<24;i++)
- {
- P0=Pattern_P0[i];
- P2=Pattern_P2[i];
- DelayMS(200);
- }
-
-
-
-
-
- }
- }
复制代码
资料下载:
花样流水灯.zip
(73.38 KB, 下载次数: 56)
|