Electronic – PIC24 Interrupt auto_psv vs no_auto_psv

interruptsmicrochippicprogramming

I'm trying to understand the options when setting up an interrupt in a pic24fj128ga010. There in an attribute option for either auto_psv or no_auto_psv.

I understand that PSV stands for program space visibility. This a window through which program memory can be accessed through the RAM address space. This is very useful when accessing, often used constant variables. By declaring them constant they only reside in program memory and don't waist RAM space.

All that being said, what do these two options actually do?

Best Answer

PSV window size is 64K which could be smaller than whole ROM size on certain parts (like the one you're using). On those, if you have more than 64K of constants you'd have to move the window to access them all. If you have an ISR which accesses constants 'auto_psv' will make sure you can do this. On the other hand, if your ISR doesn't use constants set this attribute to 'no' to reduce code size.