| ??? 12/11/03 03:14 Read: times |
#60411 - RE: potato, potatoe Responding to: ???'s previous message |
You know David, the way I deal with this issue that you are trying to make is to eliminate the need for the special semaphors between the ISR and the main code completely. I then have the ISR functions all pass their data back and forth between the main program level via queues. The main loop of the program is then a series of calls that are made in a round robin manner to check if there is arriving data in any queue to process or if certain results are needed to be placed into outgoing queues. The main look simply has a single bit flag variable that is cleared at the top of the loop to zero. Then as each main loop state routine is called (some of the called routines often embody a state machine) if it makes any action that shows that the main loop should run again it will set this bit flag. At the bottom of the main loop this flag is checked and if it is set then control is returned to the top of the loop for another cycle through the machine application. If however at the end of the main loop there is a zero in this bit flag it means that the main loop has no immediate work to do...so I ensure that interrupts are enabled (normally at this level they are always enabled anyway) I would then put the processor in IDLE mode. The instruction right after the IDLE setting instruction is a JMP TOP_MAIN_LOOP. Any interrupt occurs will take one out of the idle mode and it gets processed right away and the the main line program takes over at the JMP and wraps to the top of the main loop. If the waking interrupt had casued the queueing or dequeueing of something that results in main loop work it is handled right away. After the main loop becomes "caught up" the above described bit flag system will permit a return to the idle mode.
Michael Karas |
| Topic | Author | Date |
| Interrupts & Idle mode | 01/01/70 00:00 | |
| RE: Interrupts & Idle mode | 01/01/70 00:00 | |
| RE: Interrupts & Idle mode | 01/01/70 00:00 | |
| RE: fully compatible with the MCS-51 | 01/01/70 00:00 | |
| potato, potatoe | 01/01/70 00:00 | |
| RE: potato, potatoe | 01/01/70 00:00 | |
| RE: potato, potatoe | 01/01/70 00:00 | |
| RE: potato, potatoe | 01/01/70 00:00 | |
| RE: potato, potatoe | 01/01/70 00:00 | |
| RE: potato, potatoe | 01/01/70 00:00 | |
| RE: potato, potatoe | 01/01/70 00:00 | |
| RE: potato, potatoe | 01/01/70 00:00 | |
| RE: potato, potatoe | 01/01/70 00:00 | |
| RE: Interrupts & Idle mode | 01/01/70 00:00 | |
| RE: Interrupts & Idle mode | 01/01/70 00:00 | |
| RE: Interrupts & Idle mode | 01/01/70 00:00 | |
RE: Interrupts & Idle mode | 01/01/70 00:00 |



