在proteus里使用 7SEG MPX4 CC 顯示正常 但是我沒有這個。。 只有4個共陰極LED數(shù)碼管
但是改了之后顯示不正常 是什么原因呢? 求大神指教
程序如下:uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x89,0x86 }; //0,1,2,3,4,5,6,7,8,9,h,e
void xian(int timer)
{
a=timer/1000; //千位
b=(timer%1000)/100;//百位
c=(timer%1000)%100/10;//十位
d=timer%10; //個位
P2=0Xfe;
P0=table[a];
delay(5);
P2=0XFF;
P2=0Xfd;
P0=table[ b];
delay(5);
P2=0XFF;
P2=0Xfb;
P0=table[c];
delay(5);
P2=0XFF;
P2=0Xf7;
P0=table[d];
delay(5);
}
歡迎光臨 (http://www.torrancerestoration.com/bbs/) | Powered by Discuz! X3.1 |