xTimer V1.0
[05-23 02:47:29] 来源:http://www.88dzw.com 单片机电路图 阅读:8450次
文章摘要:You may see every key checking, flag1 bit 0 will set. This flag will signal the set timer task that key has been pressed, so on entering it will check if this bit = 1, it will not repeat running. The task that reset this bit will check if all keys have been released is shown below. using logical AND
xTimer V1.0,标签:电路图讲解,电路图练习,http://www.88dzw.comYou may see every key checking, flag1 bit 0 will set. This flag will signal the set timer task that key has been pressed, so on entering it will check if this bit = 1, it will not repeat running.
The task that reset this bit will check if all keys have been released is shown below. using logical AND P3 with 0x3C. If all bits are '1', then clear bit 0 of flag1.
key_release() { if((P3&0x3c) == 0x3c) flag1 &= ~1; } |
run_timer( ) can be one second resolution, so we put it running every second with the help of incrementing of one_second variable. All four timers will run every second then. The shutdown task also runs every second. We will see later for shutdown detail.
run_timer() { if(++one_sec>=100) { one_sec = 0; run_timer1(); run_timer2(); run_timer3(); run_timer4(); shutdown(); // run shutdown checking every second } } |
Now look at the sample code that runs timer1.
run_timer1() { if(timer1 != -1) // enter only preset value != -1 { if(timer1 != 0) // enter only timer1 != 0 { timer7 = 0; // reset shutdown timeout buzzer1 = off; flag1 |= 0x02; setbit(output1) if(++timer1_clk >= 60) // timer1 is one min based! |
- 上一篇:XC4003的最小系统电路
《xTimer V1.0》相关文章
- › xTimer V1.0
- 在百度中搜索相关文章:xTimer V1.0
- 在谷歌中搜索相关文章:xTimer V1.0
- 在soso中搜索相关文章:xTimer V1.0
- 在搜狗中搜索相关文章:xTimer V1.0