hey
iam trying to implement a state machine on a PIC16F876
Iam using timer0 to setup timed events a tick for every 13.1ms,
a tick100 for 100ms and a ticksec for 1sec. I place these in a buffer when they occur inside the interrupt service routine.
The problem is that the tick happens alot quicker obvioulsy so the buffer gets filled with tick events, then the odd tick100 and ticksec.
In normal program flow the program graps all these tick events and runs them within a few ms from the buffer. I know fundamentally my buffer idea is the problem, iam windering if anyone has done something similar or would have any advice on setting up such a scheme??
I started using a buffer because i want to put other events in the
queue, for example the keypad is scanned during the ISR aswell and this may or maynot place an event in the queue.
I was thinking of checking the buffer for example a tick event and if there is one there then dont place another one in the buffer. How does this sound? My main concern is that i dont want to spend two long in the ISR?
Thanks
Michael
iam trying to implement a state machine on a PIC16F876
Iam using timer0 to setup timed events a tick for every 13.1ms,
a tick100 for 100ms and a ticksec for 1sec. I place these in a buffer when they occur inside the interrupt service routine.
The problem is that the tick happens alot quicker obvioulsy so the buffer gets filled with tick events, then the odd tick100 and ticksec.
In normal program flow the program graps all these tick events and runs them within a few ms from the buffer. I know fundamentally my buffer idea is the problem, iam windering if anyone has done something similar or would have any advice on setting up such a scheme??
I started using a buffer because i want to put other events in the
queue, for example the keypad is scanned during the ISR aswell and this may or maynot place an event in the queue.
I was thinking of checking the buffer for example a tick event and if there is one there then dont place another one in the buffer. How does this sound? My main concern is that i dont want to spend two long in the ISR?
Thanks
Michael