74LS154譯碼器的應(yīng)用
#include
unsigned char idata dis_code[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0X0D,0x0E,0x0F} ;
/*************延時(shí)子程序*******************************/
void delay(unsigned int x)//最小1毫秒
{
unsigned char j;
while(x--)
{
for(j=0;j<125;j++)
{;}
}
}
void main()
{
unsigned char i;
while(1)
{
for(i=0;i<16;i++)
{
P2=dis_code[i];
delay(500);
}
}
}
仿真電路:
評論