单片机学习之项目1流水灯2定时器.pptVIP

  • 3
  • 0
  • 约9.47千字
  • 约 39页
  • 2017-06-10 发布于四川
  • 举报
#includereg52.h void main() { unsigned int counter,value=0x01; TMOD=0x01; TH0=0x3c; TL0=0xb0; TR0=1; //此位可位操作 while(1) { if(1==TF0) {TH0=0x3c; TL0=0xb0; TF0=0; counter++;} if(20==counter) {counter=0; P1=~value; value=value1; if(value==256) value=0x01; } } } 时间间隔1s=20*50ms的流水灯; 50ms 初值=15536=0x3CB0 方法3 #includereg52.h void main() { unsigned int i=0,value=0x01; TMOD=0x01; TH0=0x3c; TL0=0xb0; TR0=1; //此位可位操作 while(1) { if(1==TF0) {TH0=0x3c; TL0=0xb0;

文档评论(0)

1亿VIP精品文档

相关文档