我这个程序如下:
#include<reg52.h>
sbit ser=P2^0;
sbit OE=P2^1;
sbit rck=P2^2;
sbit sck=P2^3;
unsigned char code duan[10]={0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char code wei[8]={0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f};
void delay(unsigned char i);
void delay2ms(void)
{
unsigned char i,j;
for(i=100;i>0;i--)
for(j=6;j>0;j--);
}
void in_wei(unsigned char Data)
{
unsigned char i;
for(i=0;i<8;i++)
{
sck=0;
ser=Data&0x80;
Data<<=1;
sck=1;
}
}
void in_duan(unsigned char Data)
{
unsigned char i;
for(i=0;i<8;i++)
{
sck=0;
ser=Data&0x80;
Data<<=1;
sck=1;
}
}
void out()
{
rck=0;
rck=1;
}
void main()
{
unsigned char i=0;
OE=0;
while(1)
{
rck=0;
in_wei(wei[i]);
in_duan(duan[i]);
out();
delay2ms();
i++;
if(i>7)
i=0;
}
}
void delay(unsigned char i)
{
while(--i);
}
为什么数码管不会动态显示 ???
要动态显示该怎么修改????
求大神!!!!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>