代码如下,请指教:
#define uchar unsigned char
#define uint unsigned int
#define dispout P1
#define dispbit P2
//*********************0****1****2****3****4****5****6****7****8****9***10***11***12***13***14***15***16***17***18***19***20***21****
//*********************0****1****2****3****4****5****6****7****8****9****a****b****c****d****e****f****h****j****l****p****u****y****
uchar code seg7[22]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xb9,0xde,0x8c,0x8e,0x89,0x8e,0xb8,0x8c,0xc1,0x91};//new board
//********************************************************
void display2482(uchar dat1,uchar dat2,uchar dat3)//显示格式:dat1 前2位,dat2 后2位,dat3 首位显示的字母,第1位+X
{
uchar a1,a2,a3,a4;
//dat2=ledbaktime;
a1=dat1/10+dat3;a2=dat1%10;a3=dat2/10;a4=dat2%10;
a1=1;a2=2;a3=3;a4=4;
if(ledbaktime>0){dispON=1;} else {dispON=0;mode_num=0;modemenu=0;modedelay=0;}
if((k2482%4==0)) {dispout=seg7[a1];if((a1==0)|(dispON==0))dispbit=0x00;else dispbit=0x01;delayms(2);dispbit=0x00;}
//else if((k2482%4==1)){if (colon)dispout=seg7[a2]-0x80;else dispout=seg7[a2];if(dispON==0)dispbit=0x00;else dispbit=0x02;}
else if((k2482%4==1)){if (colon)dispout=seg7[a2]-0x80;else dispout=seg7[a2];if(dispON==0)dispbit=0x00;else dispbit=0x02;delayms(2);dispbit=0x00;}
else if((k2482%4==2)){dispout=seg7[2];if(dispON==0)dispbit=0x00;else dispbit=0x04;delayms(2);dispbit=0x00;}
else if((k2482%4==3)){dispout=seg7[a4];if(dispON==0)dispbit=0x00;else dispbit=0x08;delayms(2);dispbit=0x00;}
k2482++;
}
|