cancel
Showing results for 
Search instead for 
Did you mean: 

changing GP Outputs from interrupt and task

sholz9
Associate II
Posted on November 11, 2005 at 11:06

changing GP Outputs from interrupt and task

3 REPLIES 3
sholz9
Associate II
Posted on November 11, 2005 at 09:44

Actually we evaluate the STR7xx for our new products.

Now I consulted the Reference- manual and didn't find any solution for following problem/issue:

I use digital outputs.

One digital output pin (Bit 0) is controlled by an interrupt routine.

The other digital output pin (Bit 1, same register) is controlled by a normal task.

I don't know exactly, how the compiler/assembler works but following scenario is possible:

1. The main- routine tries to set its Bit 1:

This has to be done by reading, modifying and writing the GPIO- data- memory.

2. Exact after reading the main- task is interrupted.

3. The interrupt routine has to sets its bit 0. This is also done by reading, modifying and writing the GPIO- data- memory.

4. After the interrupt routine the main task continues its work with modifying and writing.

5. The bit 0 (set by the interrupt) will be ZERO after this action! Because the main task doesn't know nothing about the interrupt- routine.

This problem is essential for handling the GPIO's.

Are there any suggestions or work arounds to solve this problem?

ben2
Associate II
Posted on November 11, 2005 at 10:01

you must put a disable/enable interrupt in your main loop around the bit read/set command.

of course this will possibly increase your interrupt latency

sholz9
Associate II
Posted on November 11, 2005 at 10:56

That's the problem! I don't like to disable the interrupts to switch on and off an output.

The further problem is that I not only have to disable and enable the interrupt, but I have also to save the actual interrupt enable- register and to restore it safe.