部分源程序如下:
//--------------------------------------------------------
//| SN | EW
//| 红 | 黄 | 绿 |左绿| 红 | 黄 | 绿 |左绿|
//|P1.7|P1.6|P1.5|P1.4|P1.3|P1.2|P1.1|P1.0|
//| 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 |;0X28
//| 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 |;0X48
//| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 |;0X18
//| 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 |;0X48
//| 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |;0X82
//| 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |;0X84
//| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |;0X81
//| 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |;0X84
//| 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |;0X88
//================================================
//--------------------------------------------------------
void delay1ms(void)
{
unsigned char i,j;
for(i=2;i>0;i--)
for(j=248;j>0;j--);
}
//================================================
void delay5ms(void)
{
unsigned char i,j;
for(i=10;i>0;i--)
for(j=248;j>0;j--);
}
/*****************显示子函数**************************/
void Display(void)
{ P0=table[Time_EW];
EW_LED2=1;
delay1ms();
EW_LED2=0;
P0=table[Time_EW/10];
EW_LED1=1;
delay1ms();
EW_LED1=0;
//----------------------------
P0=table[Time_SN];
SN_LED2=1;
delay1ms();
SN_LED2=0;
P0=table[Time_SN/10];
SN_LED1=1;
delay1ms();
SN_LED1=0;
}
1