??? 02/16/06 13:34 Read: times Msg Score: +1 +1 Informative |
#110139 - push/pop in isr Responding to: ???'s previous message |
Bernd Nollmeyer said:
Saving the register inside ISR is not neccesary but as you can imagine I use this code also in other projects so its universal. Generally, this is many times a problem, how to make a program in such way that extensions to it added later when the thorough knowledge of the details already faded out (or by somebody who never had that "thorough knowledge") would not make any harm. Therefore some assumptions are often made, one example of them is that a basic set of registers (accumulator, PSW) is free to be used throughout the program (implying they are pushed in ISRs). This is always a tradeoff, and the best example of it is the usage of high level languages, where their formalism prevents a lot of errors, but the price for it is the less efficient usage of resources. So, if you want to make your ISRs "foolproof", you push registers like crazy. If you want to be super-efficient, you omit the pushes unless absolutely necessary. In between, you might leave the pushes where they are and place a semicolon before them to comment them out, perhaps also adding a note to remind the reader to un-comment them when needed. 0.20 SKK Jan Waclawek |