我这个Proteus的图有什么问题???
我想实现的是让发光二极管D12由灭到均匀变亮到最亮之后均匀熄灭,且在最亮和最灭的时候蜂鸣器报警一次,但是他不会发亮和警报(以下是我的代码)
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula = P2^6;
sbit wela = P2^7;
sbit dawr = P3^6;
sbit dacs = P3^2;
sbit beep = P2^3;
void delay(uint z)
{
uint i,j;
for(i = z;i > 0;i--)
for(j = 110;j > 0;j--);
}
void main()
{
uchar val,flag;
dula = 0;
wela = 0;
dacs = 0;
dawr = 0;
P0 = 0;
while(1)
{
if(flag == 0)
{
val += 9;
P0 = val;
if(val == 255)
{
flag = 1;
beep = 0;
delay(100);
beep = 1;
}
delay(322);
}
else
{
val -= 9;
P0 = val;
if(val == 0)
{
flag = 0;
beep = 0;
delay(100);
beep = 1;
}
delay(322);
}
}
}