??? 08/21/05 12:47 Read: times |
#99773 - Outlaw coding! Responding to: ???'s previous message |
Erik,
"5) anything timing dependent that is not interrupt based is outlawed. " In the interests of having provable software, one should minimise interrupts where possible, even eliminate them as they provide asynchronous interruption to the program flow. To fully prove the code, one would need to test having an interrupt occur in each line of code to ensure the response is correct. This is, of course, time consuming. As you will agree, a system with no interrupt source is a lot easier to test than a system with 10 interrupt sources. In my extensive experience and reading, suggesting that timing must be reliant on interrupts has no base. However, using timer hardware should be encouraged and why discourage a software delay where appropriate? I was asked earlier this year by a young engineer given the task of doing a code review of code I wrote why I used in some instances NOP(); for some delays and a for loop in another. I explained that one loop of the for loops took quite a few cycles, so when I only wanted to use a couple of cycles for a delay, I used NOP(), for longer delays I used the for loop. Misra makes no mention of this 'rule'! What standard are you working from that makes this assertion? DoWhile Jones wrote a compeling article about the (ab)use of interrupts some time ago in circuit Cellar. Therac25 would have benefitted by avoiding interrupts! |