Part Number: MSP430FR6989
My question is more of an abstract one, but I will try and give some pseudo-code later. I am trying to implement a system where my MSP will begin a certain process once it receives an external signal. I am familiar with interrupts enough to know that it is frowned upon to have the entire computation run in the interrupt, and it is frowned upon to call a function from an interrupt, as the "process" (forgive me, I can't think of the proper term right now) waits in the interrupt until the function is finished. What I'm looking for is something similar to the following:
configure_settings(void)
{
//configure stuff
}
int main()
{
//set up stuff
_enable_interrupts();
_low_power_mode();
}
#pragma vector = interrup_vector
__interrupt void check_signal(void)
{
//receive byte
//check for start signal
if (start signal == received)
function(void);
}
void function(void)
{
//do all of the computing
//that I want to do in
//this function, rather
//than the interrupt
}
I know that very little of the code above uses the correct syntax or keywords, but this is more of a conceptual question than a debugging one. The way the above pseudo-code will run will be that the "process" will run the function within the ISR, and then return to the ISR once the functions execution has ceased. Admitting this practice is bad, my setup would theoretically allow this as I can guarantee that no other external interrupts will arrive before the function is done.
I was curious if the MSP architecture would allow for the process to look a little more like:
- ISR is entered
- Start signal is received
- Interrupts disabled/flags cleared
- ISR exited
- Function called
- Reenter LPM once function is done
Is there any way to do this?