初学者:初学者:SOS!!!!
# include <reg51.h>
# define uchar unsigned char
uchar time;
uchar count=50;
void time0(void) interrupt 1 using 1 {
TH0=-40000/256;
TL0=-40000%256;
if (count == ++time) {time=0; P1=!P1;}
}
void main() {
TMOD = 0x01;
TH0=-40000/256;
TL0=-40000%256;
EA=1; ET0=1; TR0=1;
do {} while(1);
}
我本来是想让P1的八个LED灯闪(2秒亮,2秒灭),结果发现开始的时候是P1全部亮一次,
后来就只有P1.0在闪了。
发表时间:2003年1月15日17:11:00