51单片机汇编代码转换为C语言:8*8点阵从右至左滚动显示0-4,要求要与此代码流程一致。reg52.h
2个回答
展开全部
#include<reg51.h>
#define uchar unsigned char
uchar tab[]={0x7e,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
uchar nub[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7e,0x81,0x81,0x81,0x81,0x7e,0x00,
0x00,0x01,0x41,0x41,0xff,0x01,0x01,0x00,
0x00,0x41,0x83,0x85,0x89,0x91,0x61,0x00,
0x00,0x42,0x81,0x91,0x91,0x91,0x6e,0x00,
0x00,0x0e,0x12,0x22,0x42,0xff,0x02,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
uchar r_cnt,l_cnt,numb,tcount;
void int_t0() interrupt 1
{
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
P2=tab[r_cnt];
P1=nub[numb];
numb++;
r_cnt++;
if(r_cnt==8)
{
r_cnt=0;
numb=l_cnt;
}
tcount++;
if(tcount==40)
{
tcount=0;
l_cnt++;
if(l_cnt==48)l_cnt=0;
else numb=l_cnt;
}
}
main()
{
l_cnt=0;
r_cnt=0;
numb=0;
tcount=0;
TMOD=0x01;
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
TR0=1;
IE=0x82;
while(1);
}
#define uchar unsigned char
uchar tab[]={0x7e,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
uchar nub[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7e,0x81,0x81,0x81,0x81,0x7e,0x00,
0x00,0x01,0x41,0x41,0xff,0x01,0x01,0x00,
0x00,0x41,0x83,0x85,0x89,0x91,0x61,0x00,
0x00,0x42,0x81,0x91,0x91,0x91,0x6e,0x00,
0x00,0x0e,0x12,0x22,0x42,0xff,0x02,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
uchar r_cnt,l_cnt,numb,tcount;
void int_t0() interrupt 1
{
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
P2=tab[r_cnt];
P1=nub[numb];
numb++;
r_cnt++;
if(r_cnt==8)
{
r_cnt=0;
numb=l_cnt;
}
tcount++;
if(tcount==40)
{
tcount=0;
l_cnt++;
if(l_cnt==48)l_cnt=0;
else numb=l_cnt;
}
}
main()
{
l_cnt=0;
r_cnt=0;
numb=0;
tcount=0;
TMOD=0x01;
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
TR0=1;
IE=0x82;
while(1);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询