[En-Nut-Discussion] TC interrupt / GPIO interrupt

Hans Bacher hmbacher at googlemail.com
Mon Nov 8 09:00:42 CET 2010


Hi again!

I have 2 questions on using NutOS with an AT91SAM7X, perhaps someone can
help me.

1) I'm using Timer Counter 0. After configuring the TC itself, I assign my
user defined ISR 'tcISR' by calling 'NutRegisterIrqHandler(&sig_TC0, &tcISR,
0);'. This works, the interrupt occurrs as expected. Now I like to handle
different kinds of interrupt events (counter overflow, capture register A/B
loaded, etc.). Is their a way to determine the original reason for the
interrupt (from within tcISR), as the TC0 Status Register TC0_SR is already
read (and hence cleared?) in the NutOS intterupt handler
(TimerCounter0IrqEntry(): ... dummy = inr(TC0_SR); ...)??

2) I'm using the Pin Change Interrupt capability on pin PB24. Again I
assigned my user defined ISR 'pcISR' by calling 'GpioRegisterIrqHandler(2,
24, pcISR, 0);' This works! But now, I only have to handle the rising edge
of the signal. How can I (1) determine the Pin within the ISR 'pcISR', that
caused the interrupt, as any Pin of Port B could have done this. And how
would I (2) test on rising/falling edge? Simply by reading the Pin Data
Status Register of the appropriate Port B?

Thanks a lot for any suggestions, unfortunately I could not find these
"simple" things in any example...

Regards,

Hans



More information about the En-Nut-Discussion mailing list