|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Interrupt Handlers and Variable Scope
I'm trying to implement a shaft encoder which simply triggers an interrupt handler and increments a variable every time the encoder creates a pulse.
The code mostly works, in that the interrupt handler is called when the pulse on Digital Input 1 occurs, it then checks the value of digital input 10 for the B phase, and increments and decrements a counter as appropriate. The interrupt handler is getting called, since I can put debugging printf()'s in there which show +'s and -'s every time the handler is called. The problem is that the global variable I'm using isn't ever incremented or decremented, like a scope problem. I've read the C18 manual about interrupt handlers, and thought I had everything taken care of: I've already got a #pragma interruptlow interrupt_handler_low save=section(".tmpdata) And I've tried #pragma interruptlow interrupt_handler_low save=variablename but neither of these help. Ideas? (I'd post the exact code, but it's over with the bot without an internet connection. Perhaps later this evening). |
|
#2
|
||||
|
||||
|
Re: Interrupt Handlers and Variable Scope
Quote:
|
|
#3
|
||||
|
||||
|
Re: Interrupt Handlers and Variable Scope
Quote:
-Kevin |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|