软件查询方式实现数码管闪烁
#include <reg52.h> #define uint unsigned int #define uchar unsigned char sbit led1 = P1^7 ; sbit led2 = P2^3 ; uint i,num ; void init(){ TMOD = 0X01; TR0 = 1; } void main() { while(1) { init(); for(i=0;i<2;i++) { while(num>50000) { num = TH0*256+TL0; } TH0 = 0; TL0 = 0; } led1 = ~led1; led2 = ~led2; } }