Dan, You can change the IMASK register on the 219x while in a ISR when using non-nested interrupts. For example, you might have a message transceiver ISR (SPORT, SPI, UART, etc) that masks it's interrupt when a message has been received to prevent further interrupts. If using nested interrupts, you'd have more then just a hardware context switch and would need to save all the registers to the stack. If your worried about some ISR changing the status of something in nested ISR code... turn off the interrupts for the section of code that your concerned with. Using a critical section is also a good idea when you have shared resources (ie registers or memory locations) amongst ISRs and regular sequenced code. Otherwise, GET/SET problems occur where say one interrupt GETS the value from a register and prior to writting back out to that register another interrupt occurs which GETS and SETS the register. Even in an non-nested approach you'd probably want to run a critical section around IMASK to prevent get GET/SET side effects. Also, if you have multiple interrupts for one ISR vector you'll need to use the Interrupt Source Registers (INTRDx) to determine the interrupts that have occured for a particular priority. Regards, Tim Dahlin Can the group owner change the default reply to the group instead of the individual who wrote the message being replied to? |