Interrupt Questions-18F4550

Status
Not open for further replies.

toodles

New Member
From reading the datsheet on the 4550, I know that there are two interrupt vectors, a low and a high, and the address for where these interrupt routines start is located at 0x18 and 0x8, respectively. From what I can gather, those addresses are the code addresses in the flash.

1. Is it possible to change these vectors during run? Say, have it check a pushbutton after reset, and have the high vector point to Func1() if pressed, and if the pushbutton isn't pressed, have the high vector point to Func2()? Is it possible to modify these addresses by changing registers? I'd like to do this without re-writing the flash every reset.

2. I need to monitor two I/O pins for any change, and if they change, then trigger the interrupt. The interrupts for the RB0 and RB1 have to specify which edge to trigger the interrupt, either rising or falling. So, I would like to have the interrupt routine change the INTEDGx bits that control which edge will trigger. There's a nice warning box in the datasheet that says 'Do not use the MOVFF instruction to modify any of the interrupt control registers while any interrupt is enabled.' I am assuming that since the first line of the interrupt function will be to disable interrupts until its finished, that this won't be a problem. Can anyone confirm I'll be ok just tweaking the INTEDGx bits during the interrupt?
 
Yes they're in flash, and no they can't be changed.
Just store the state of the buttons in some ram variables and do the equivalent of this is your interrupt routine.
You really want to use the "interrupt on change" capability of the Port B bit 4:7 inputs instead of the INT pins on Port B 0:2

P.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…