Hello All,
This is my first post on this forum and I am using an MSP430G2553 and coding with Energia.
I started fiddling with my MSP430 Launchpad a few weeks ago and I am now doing a few projects that will be much simpler using Interrupt Service Routines. While discussing how interrupts work with some friends, it came up that a return from a ISR is different than from that of a regular subroutine. I do not mean the "return val;" but the actual PUSHes and POPs from the stack.
I have heard that the ISR PUSHes the status register, or some such containing current flags, onto the stack in addition to the program counter. The return from ISR must then POP 2 items from the stack (both the status register and the program counter). This is in contrast to a regular function which only PUSHes and POPs the program counter.
My concern now arises that the attachInterrupt(interrupt, function, mode) changes how the subroutine functions. This implies that the attachInterrupt function changes code, which as a programmer I find a bit troublesome.
All of this leads to a couple questions:
1. Can I use a subroutine that has been setup as an interrupt with attachInterrupt as a regular function?
2. Does the attachInterrupt function actually change the way my subroutines behave in the MSP430?