找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

一个声控流水灯的程序,有一处错误,不过找不出来,求大神帮帮

查看数: 9705 | 评论数: 3 | 收藏 2
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2017-3-3 11:30

正文摘要:

#include<reg51.h> unsigned char uchar; unsigned int uint; #define led P1; sbit voice=P2^4; uchar tab1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; uchar tab2[]={0x7f,0xbf,0xdf,0xef,0xf7,0x ...

回复

ID:165498 发表于 2017-3-6 10:40
wosiyabo 发表于 2017-3-3 16:46
#include
#define uchar unsigned char
#define uint unsigned int

谢谢!!!!!
ID:146949 发表于 2017-3-3 16:46
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
#define led P1;
sbit voice=P2^4;
uchar tab1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar tab2[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
uchar tab3[]={0xe7,0xdb,0xbd,0x7e};
uchar tab4[]={0x7e,0xbd,0xdb,0xe7};
uchar he[4] = {0,0,0,0};
uchar num=0;
uchar counter=0;
uchar counter1=0;
bit flag=0;
bit flag1=0;
void delay1m(uint x)
{
uint i,j;
for(i=0;i<x;i++)
for(j=0;j<120;j++);
}
void time0_time1_init()
{
TMOD=0x11;
TH1=(65535-50000)/256;
TL1=(65535-50000)%256;
TH0=(65535-50000)/256;
TL0=(65535-50000)%256;
TR0=0;
ET1=ET0=TR1=EA=1;
}
void main()
{
        time0_time1_init();
        delay1m(2000);
        while(1)
        {
                if(!flag1)
                        {
                        if(!voice)
                                {
                                        num++;flag1=1;
                                        //e[0]=he[1]=he[2]=he[3]=0;
                                        if(num>=5){num=0;}
                                        TR0=1;
                                }
                        }
        }
}
ID:167113 发表于 2017-3-3 13:40
#define unsigned char uchar;这样吧

小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表