hi,
the need for this topic is to discuss the disadvantage of inbuilt 'delay' macro within FC.
although it works perfect in many applications but in some applications where many interrupts are used and it is not required to keep processor in busy loop. in these cases 'delay' creates timing issues eg. if there is a seconds counter in the program, it gets delayed counts i.e. timing affects.
i went through many threads on forum but didn't get the proper answer for this.
i want to know the possible other methods to generate delays without using 'delay' macro and busy loops.
thanks and regards,
Prashant
non busy delay routine..... possible?
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: non busy delay routine..... possible?
The processing unit in a micro controller can either be executing instructions or sleeping or shutdown. In the last case nothing can happen, in the second case (sleeping) it will require time to wake which will have impact on timing and the first case (executing instructions) is currently being used...
If you want perfect timing you will need to use a timer with interrupt to create it or not use any interrupts at all (so the delay is not interrupted).
If you want perfect timing you will need to use a timer with interrupt to create it or not use any interrupts at all (so the delay is not interrupted).
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 30
- Joined: Tue Apr 16, 2013 3:10 pm
- Has thanked: 48 times
- Been thanked: 9 times
- Contact:
Re: non busy delay routine..... possible?
hi kersing,
thanks for reply,
i totally agree with your suggestion. and i tried non busy delays using timer interrupts but i didn't succeed. i will be grateful if you explain it with the example.
thanks,
Prashant
thanks for reply,
i totally agree with your suggestion. and i tried non busy delays using timer interrupts but i didn't succeed. i will be grateful if you explain it with the example.
thanks,
Prashant