Interrupt Handler Counters - what for?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interrupt Handler Counters - what for?

357 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tkreyche on Mon Mar 15 14:05:21 MST 2010
Is there some purpose that I'm missing, for the gpio_counter and p0_1_counter in the interrupt handlers? I can't find reference to them elsewhere in the library or sample application code.

thanks, Tom



[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][FONT=Arial]void[/FONT]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][FONT=Arial][SIZE=2]PIOINT0_IRQHandler([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][/FONT][SIZE=2][FONT=Arial])[/FONT][/SIZE]
[LEFT][SIZE=2][FONT=Arial]{[/FONT][/SIZE]
[SIZE=2][FONT=Arial]uint32_t regVal;[/FONT][/SIZE][/LEFT]

[LEFT][SIZE=2][FONT=Arial]gpio0_counter++;[/FONT][/SIZE]
[SIZE=2][FONT=Arial]regVal = GPIOIntStatus( PORT0, 1 );[/FONT][/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][FONT=Arial]if[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][FONT=Arial] ( regVal )[/FONT][/SIZE]
[SIZE=2][FONT=Arial]{[/FONT][/SIZE]
[SIZE=2][FONT=Arial]p0_1_counter++;[/FONT][/SIZE]
[SIZE=2][FONT=Arial]GPIOIntClear( PORT0, 1 );[/FONT][/SIZE]
[SIZE=2][FONT=Arial]} [/FONT][/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][FONT=Arial]return[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][FONT=Arial];[/FONT][/SIZE][/LEFT]
[SIZE=2][FONT=Arial]}[/FONT][/SIZE]

[/LEFT]
0 Kudos
4 Replies

349 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Sun Oct 23 18:57:32 MST 2011
That's just an example. You can put whatever code you application needs. In this case the example shows:

- the ISR handler signature
- how to mask the pin that triggers the interrupt. Remember that any GPIO pin is capable of triggering an interrupt, so the "GPIOIntStatus" register is telling you which pin triggered the interrupt. If you only have one pin for external interrupt then may be you can avoid the testing; otherwise (e.g. two or more external interrupts) you may take different action depending on which pin got activated.
0 Kudos

349 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kendwyer on Tue Mar 16 19:38:49 MST 2010
Yep, they are there to help debug the interrupt handler, keeping count of the number of times the IRQ was called.
0 Kudos

349 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tkreyche on Mon Mar 15 23:30:16 MST 2010
Interrupt works fine with the counters commented out.
0 Kudos

349 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LynnF on Mon Mar 15 17:01:08 MST 2010
Good question I have wondered the same. What I believe they may be used for is during debug you could inspect them to see how many times the interrupt may have been called. Just my 50% guess.....50% I am right.....50% I am wrong
0 Kudos