Hi,
I am starting interrupt (with MC9S12C32) and I need some help in the organiztion of one of mu program.
I have a program that is doing some function. Then when I press and realease a button (set up at PTAD0) the program stops and the LED's are supposed to flash every second using timer interrupt.When we press and release the button again the LEDs stop flashing and the main program continues.
Our teacher want us to us the following when dealing with interrupt:
- have a LED thread_begin function that start the thread( intialization of the device here timer)
- have the ISR - doing the work
- have a thread " end" that stop the LED thread
I have one issue here:
One is how to implement the part when the button is pressed and released.
My code organization is something like this:
...main program working...
Check if button pressed and released
IF yes
call LED thread_begin
In the ISR function
Does 1 second passed?
IF yes flash the LED
ELSE wait
Check if button is pressed and released
If yes
Call LED thread_stop
(return to main program)
Also wher should I place my 'check button' code?
Please can I have some help with the button and my program organization?
thank you
B