基于51单片机做的摇摇棒,出问题了,大家帮忙看看呗 15
#include<reg52.h>#defineucharunsignedchar#defineuintunsignedintsbitkey=P3^6;sbits2=P3...
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit key=P3^6;
sbit s2=P3^4;
sbit s3=P3^5;
sbit sy=P3^3;
uchar code zhangp0[]={...};
uchar code zhangp1{...};
uchar code zhangp2[]={...};
uchar code xinp0[]={...};
uchar code xinp1[]={...};
uchar code xinp2[]={...};
uchar code wop0[]={...};
uchar code wop1[]={...};
uchar code wop2[]={...};
uchar code aip0[]={...};
uchar code aip1[]={...};
uchar code aip2[]={...};
uchar code nip0[]={..};
uchar code nip1[]={...};
uchar code nip2[]={...};
uchar code xiaop0[]={...};
uchar code xiaop1[]={...};
uchar code xiaop2[]={...};
uchar code wangp0[]={...};
uchar code wangp1[]={...};
uchar code wangp2[]={...};
uchar code zaip0[]={...};
uchar code zaip1[]={...};
uchar code zaip2[]={...};
uchar code xiup0[]={...};
uchar code xiup1[]={...};
uchar code xiup2[]={...};
uchar code lip0[]={...};
uchar code lip1[]={...};
uchar code lip2[]={...};
uchar code bap0[]={...};
uchar code bap1[]={...};
uchar code bap2[]={...};
void delay(uchar ms)
{
uchar i,j;
for(i=ms;i>0;i--)
for(j=220;i>0;i--);
}
void du(uchar us)
{
while(us--);
}
//显示汉字子程序//
void dpzhang()
{
uchar a;
for(a=0;a<24;a++)
{
P0=zhangp0[a];
P1=zhangp1[a];
P2=zhangp2[a];
delay(1);
}
}
void dpxin()
{
uchar b;
for(b=0;b<24;b++)
{
P0=xinp0;
P1=xinp1;
P2=xinp2;
delay(1);
}
}
void dpwo()
{
uchar c;
for(c=0;c<24;c++)
{
P0=wop0[c];
P1=wop1[c];
P2=wop2[c];
delay(1);
}
}
void dpai()
{
uchar d;
for(d=0;d<24;d++)
{
P0=aip0[d];
P1=aip1[d];
P2=aip2[d];
delay(1);
}
}
void dpni()
{
uchar e;
for(e=0;e<24;e++)
{
P0=nip0[e];
P1=nip1[e];
P2=nip2[e];
delay(1);
}
}
void xianshi()interrupt 0 using 1
{
dpzhang();
}
void main()
{
IT0=1;
EX0=1;
EA=1;
while(1)
{
P0=0xff;
P1=0xff;
P2=0xff;
}
}
本人中职生做的是个24位的摇摇棒准备送给对象,这个程序还只是测试一下,没有编完,并没有实现所有的功能,只是显示一下第一个“张”字,但是下到单片机里后,所有的LED均不亮,一个都不亮,我肯定硬件没有问题,请各位给我参考参考吧,好人一生平安谢谢啦! 展开
#define uchar unsigned char
#define uint unsigned int
sbit key=P3^6;
sbit s2=P3^4;
sbit s3=P3^5;
sbit sy=P3^3;
uchar code zhangp0[]={...};
uchar code zhangp1{...};
uchar code zhangp2[]={...};
uchar code xinp0[]={...};
uchar code xinp1[]={...};
uchar code xinp2[]={...};
uchar code wop0[]={...};
uchar code wop1[]={...};
uchar code wop2[]={...};
uchar code aip0[]={...};
uchar code aip1[]={...};
uchar code aip2[]={...};
uchar code nip0[]={..};
uchar code nip1[]={...};
uchar code nip2[]={...};
uchar code xiaop0[]={...};
uchar code xiaop1[]={...};
uchar code xiaop2[]={...};
uchar code wangp0[]={...};
uchar code wangp1[]={...};
uchar code wangp2[]={...};
uchar code zaip0[]={...};
uchar code zaip1[]={...};
uchar code zaip2[]={...};
uchar code xiup0[]={...};
uchar code xiup1[]={...};
uchar code xiup2[]={...};
uchar code lip0[]={...};
uchar code lip1[]={...};
uchar code lip2[]={...};
uchar code bap0[]={...};
uchar code bap1[]={...};
uchar code bap2[]={...};
void delay(uchar ms)
{
uchar i,j;
for(i=ms;i>0;i--)
for(j=220;i>0;i--);
}
void du(uchar us)
{
while(us--);
}
//显示汉字子程序//
void dpzhang()
{
uchar a;
for(a=0;a<24;a++)
{
P0=zhangp0[a];
P1=zhangp1[a];
P2=zhangp2[a];
delay(1);
}
}
void dpxin()
{
uchar b;
for(b=0;b<24;b++)
{
P0=xinp0;
P1=xinp1;
P2=xinp2;
delay(1);
}
}
void dpwo()
{
uchar c;
for(c=0;c<24;c++)
{
P0=wop0[c];
P1=wop1[c];
P2=wop2[c];
delay(1);
}
}
void dpai()
{
uchar d;
for(d=0;d<24;d++)
{
P0=aip0[d];
P1=aip1[d];
P2=aip2[d];
delay(1);
}
}
void dpni()
{
uchar e;
for(e=0;e<24;e++)
{
P0=nip0[e];
P1=nip1[e];
P2=nip2[e];
delay(1);
}
}
void xianshi()interrupt 0 using 1
{
dpzhang();
}
void main()
{
IT0=1;
EX0=1;
EA=1;
while(1)
{
P0=0xff;
P1=0xff;
P2=0xff;
}
}
本人中职生做的是个24位的摇摇棒准备送给对象,这个程序还只是测试一下,没有编完,并没有实现所有的功能,只是显示一下第一个“张”字,但是下到单片机里后,所有的LED均不亮,一个都不亮,我肯定硬件没有问题,请各位给我参考参考吧,好人一生平安谢谢啦! 展开
1个回答
展开全部
void main()
{
IT0=1;
EX0=1;
EA=1;
P0=0xff;
P1=0xff;
P2=0xff;
while(1);
}
{
IT0=1;
EX0=1;
EA=1;
P0=0xff;
P1=0xff;
P2=0xff;
while(1);
}
更多追问追答
追问
没有用,我直接不要中断了在main函数里写上这些都没有反映,但是要是只写P0=zhangp0[0];
就能亮,怎么回事
P0=zhangp0[0];
P1=zhangp1[0];
P2=zhangp2[0];
delay(1);
P0=zhangp0[1];
P1=zhangp1[1];
P2=zhangp2[1];
delay(1);
....................................................................................
P0=zhangp0[23];
P1=zhangp1[23];
P2=zhangp2[23];
追答
你没有进入中断,也就是说没有触发外部中断0
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询