??? 10/06/11 11:59 Read: times |
#184104 - hw-timers for delays Responding to: ???'s previous message |
Note that all the debates about timers are related to three things:
1) The issue of writing a delay in a high-level language, without "binding" the delay to something hardware-based, is that changes in the generated code can result in huge speed differences - all the way to the delay loop being totally removed. In this case, the delay is written in assembler, which means that it will only change speed if the core execution speed is changed (other clock frequency or switching between 12-clock, 6-clock, ...). 2) The use of a busy-loop means that the program will not do anything during the delay. So a running-light like this will spent almost 100% in a "dumb" delay. Use of timers and interrupts means that the code can do other background tasks while waiting for the delay time to end. In this case, there doesn't seem to be any other tasks to do for the processor so it doesn't matter if it busy-loops. 3) A busy-loop delay created without hardware feedback will slow down the delay. So you can't write a program with heavy interrupt use that will manage an exact software-only loop even if you write the loop in assembler. This isn't relevant here, since the delay isn't critical and the code isn't intended (what we can see) to be extended with any high-speed interrupt code. |
Topic | Author | Date |
Speed control of running light | 01/01/70 00:00 | |
Please insert the legible source code | 01/01/70 00:00 | |
comments | 01/01/70 00:00 | |
please suggest some idea | 01/01/70 00:00 | |
Bad | 01/01/70 00:00 | |
Better to use timer | 01/01/70 00:00 | |
May be better - but not essential | 01/01/70 00:00 | |
Ok that 's fine | 01/01/70 00:00 | |
hw-timers for delays | 01/01/70 00:00 | |
there doesn't seem to be any other tasks | 01/01/70 00:00 | |
Not uncommon to have | 01/01/70 00:00 | |
no, you don't | 01/01/70 00:00 | |
do you have pullups on P0? | 01/01/70 00:00 | |
***__HORRIBLE CODE__*** | 01/01/70 00:00 | |
This Problem Shouts "Use a Table" | 01/01/70 00:00 | |
new tutorial needed | 01/01/70 00:00 |