#include<reg52.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar byte;
sbit io=P3^0;
void deply(uchar z);
sbit clk=P3^1;
uchar table[]={0x03,0x9f,0x25,0x0d,0x99,0x49,0x41,0x1f,0x01,0x09};
void sendbyte(byte)
{
uchar num,c;
num=table[byte];
for(c=0;c<8;c++)
{
clk=0;
io=num&0x01;
clk=1;
num=_cror_(num,1);
}
}
void main()
{
P2=0;
deply(100);
while(1)
{
sendbyte(1);
deply(100);
P2=0xff;
}
}
void deply(uchar z)
{
uchar i,j;
for(i=z;i<0;i--)
for(j=500;j<0;j--);
}
用
单片机控制74ls164驱动数码管怎么不会显示呢?
恩,对着的,把共阳数码管的table表反着写的,
一周热门 更多>