书上给我的代码是这样的,他是要
仿真软件运行的,所以是不是代码里缺少了脉冲的输入语句???我运行后没反应,我不知道怎么给T0对应的P3^4管脚输一个脉冲
#include<reg52.h>
#define uchar unsigned char
#define ziweima P2
#define zixingma P0
uchar code zixing[]={
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
uchar code ziwei[]={0xe3,0xe7,0xeb,0xef,0xf3,0xf7,0xfb,0xff};
uchar i=0;
void
timerint()
{
TMOD=0x06;
TH0=0x0FD;
TL0=0x0FD;
ET0=1;
EA=1;
TR0=1;
}
void display()
{
zixingma=zixing[8];
ziweima=ziwei[7-i];
}
void timer0() interrupt 1 using 0
{
i++;
if(i==8)
i=0;
}
void main()
{
timerint();
while(1)
{
display();
}
}
一周热门 更多>