|
出现光敏电阻值得变化控制不了led灯的亮灭程序如下
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit clock=P2^4;
sbit start=P2^5;
sbit boc=P2^6;
sbit oe=P2^7;
sbit shuchu=P3^0;
uchar temp;
yanshi(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void main()
{
start =0;
clock=0;
yanshi(40);
boc=1;
yanshi(70);
boc=0;
P1=0xff;
temp=P1;
if(temp<128)
shuchu=0;
else
shuchu=1;
}
|
|