利用硬件定时实现流水灯.pptVIP

  • 19
  • 0
  • 约9.47千字
  • 约 39页
  • 2019-02-12 发布于天津
  • 举报
利用硬件定时实现流水灯

#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精品文档

相关文档