声光控制开关设计电路程序有问题
#include<reg51.h>#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar temp,aa,bai,shi,ge,tt;
uchar
table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar code table1[]={0xfb,0xfd,0xfe};
sbit open=P3^7;
sbit key1=P1^0;
sbit key2=P1^1;
sbit key3=P1^2;
sbit light=P3^2;
sbit adCS=P3^1;
sbit adDI=P3^3;
sbit adDO=P3^3;
sbit adCLK=P3^0;
uchar getdat;
void display(uchar shi,uchar ge);
void delay(uint z);
void keyscan();
void init();
uchar adc0832(unsigned char channel);
void main()
{
init();
keyscan();
while(1)
{
light=1;
if(light==0)
{
getdat=adc0832(1);
display(temp/10,temp%10);
if(getdat>120)
{
shi=temp/10;
ge=temp%10;
display(shi,ge);
TR0=1;
if(aa==16)
{
open=0;
aa=0;
temp--;
if(temp==-1)
{
temp=0;
open=1;
}
}
}
}
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=125;y>0;y--);
}
void display(uchar shi,uchar ge)
{
P2=0xfe;
P0=table[shi];
delay(1);
P2=0xfd;
P0=table[ge];
delay(1);
P2=0xfc;
}
void init()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=0;
IE0=1;
IT0=1;
EX0=1;
light=1;
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
aa++;;
}
void int0() interrupt 0
{
light=0;
}
void keyscan()
{
if(key1==0)
{
delay(5);
if(key1==0)
{
temp=10;
}
}
if(key2==0)
{
delay(5);
if(key2==0)
{
temp=20;
}
}
if(key3==0)
{
delay(5);
if(key3==0)
{
temp=30;
}
}
}
uchar adc0832(unsigned char ch)
{
uchar i=0;
uchar j;
uint dat1=0;
uchar dat2=0;
if(ch==0)ch=2;
if(ch=1)ch=3;
adDI=1;
_nop_();
_nop_();
adCS=0;
_nop_();
_nop_();
adCLK=1;
_nop_();
_nop_();
adCLK=0;
_nop_();
_nop_();
adCLK=1;
adDI=ch&0x1;
_nop_();
_nop_();
adCLK=0;
_nop_();
_nop_();
adCLK=1;
adDI=(ch>>1)&0x1;
_nop_();
_nop_();
adCLK=0;
adDI=1;
_nop_();
_nop_();
for(i=0;i<8;i++)
{
dat1|=adDO;
adCLK=1;
_nop_();
_nop_();
adCLK=0;
_nop_();
_nop_();
dat1<<=1;
if(i==7)dat1|=adDO;
}
for(i=0;i<8;i++)
{
j=0;
j=j|adDO;
adCLK=1;
_nop_();
_nop_();
adCLK=0;
_nop_();
_nop_();
j=j<<7;
dat2=dat2|j;
if(i<7)dat2>>=1;
}
adCS=1;
adCLK=0;
adDO=1;
dat1<<=8;
dat1|=dat2;
return(dat1);
}
这是声光控制开关设计,有以下错误:
compiling 333.c...
333.C(89): error C100: unprintable character 0xA3 skipped
333.C(89): error C100: unprintable character 0xBB skipped
333.c - 2 Error(s), 0 Warning(s).
请大家帮忙看看