总算行了,发光二极管能根据电压 大小 点亮了
#include<REG52.H> #define uchar unsigned char #define uint unsigned int sbit P36 = P3^6; sbit P32 = P3^2; unsigned long x=0; void main() { TMOD=0x0d; while(1){ TH0=0xD8; TL0=0xEF; while(!P32); TR0=1; while(P32); while(!P32); TR0=0; x=TH0*256+TL0; if(x<=13500) P36=1; else P36=0; } } |
|