时钟闪烁移动
代码说明:
#include"reg51.h" sbit SET_K = P1^0; //设置 sbit PLUS_K = P1^1;//左移加1 sbit SHIFT_K = P1^2;//左移 sbit CHANGE_K = P1^3;//切换 年、月、日 bit SecFlag = 0; bit FlashFlag = 0; unsigned int Counter = 0; unsigned char Led0,Led1,Led2,Led3,Led4; unsigned char Shift; code unsigned char LedSeg[10] = {0x3f,0x06,0x5B,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; void Time0() interrupt 1 // 0: EX0 1:Time0 2: EX1 3: Time1,4:serial 中断 { static unsigned int IntCnt; TH0 = 0xfc; TL0 = 0x66; if(++IntCnt > 1000) { IntCnt = 0; SecFlag = 1; } switch(++Counter%5) //显示功能 { case 0:
下载说明:请别用迅雷下载,失败请重下,重下不扣分!