用的74hc138驱动位码是第一位和最后一位倒置了,怎么回事?求原因和解决的办法???、
PCB打样找华强 http://www.hqpcb.com 样板2天出货
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
#define qw P1
uchar tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x98};// 显示段码值
uchar home[8]={1,0,2,2,3,6,8,5}; //时分秒
//uchar disp[6];
uchar wei[8]={0,1,2,3,4,5,6,7};
void delayus(uchar a) //延迟
{
uchar i,j;
for(i=0;i<a;i++)
for(j=0;j<110;j++);
}
main()
{
uchar i;
qw=0xff;
P2=0xff;
/*/disp[0]=home[0]/10;
disp[1]=home[0]%10;
disp[2]=home[1]/10;
disp[3]=home[1]%10;
disp[4]=home[2]/10;
disp[5]=home[2]%10; */
while(1)
{
//P2=0xff;
//qw=0x00;
for(i=0;i<8;i++)
{
qw=wei[i];
P2=tab[home[i]];
delayus(2);
}
delayus(2);
}
}
-
一周热门 更多>