Looking for help with MSP430 interrupts
I am working on a grad school project that is using CrossWorks to write code for an MSP430F2618. We have began playing around writing sample code but we have run into a problem with interrupts. According to the documentation in CrossWorks the basic format for declaring interrupts is to have __enable_interrupt() in the main function and an interrupt function of the following format:
void handle_timer_interrupt(void) __interrupt[TIMER_VECTOR]
{
/* Handle interrupt here */
}
The problem we are having is we would like to test interrupts using the MSP430 Core Simulator. However, we cannot find any examples (sample code or documentation) showing how to write an interrupt that can be triggered from our code, everything refers to events being triggered from hardware only.
a) Is there a way to simulate the system timer and use it to trigger interrupts?
b) Is there a way to create a new TIMER_VECTOR and trigger it from code? Is there a good place we could find examples?
Thanks
-
If you load the ctl samples these use the simulated timerA supplied in the msp430periperhals.js. You need to enable the peripheral simulation file using the target properties of the simulator.
The msp430peripherals.js file is a JavaScript file that contains functions that are called by the simulator to read and write peripheral memory and to poll for interrupts. You can modify it with a text editor, take a local copy of it first and modify the target property to point to the local copy. It is loaded into the simulator when you connect to the target. You can't debug it when it is running with the simulator (and if it goes into an endless loop it will lock up CrossStudio).
You can however use the Javascript console to load the file (using the load function) and you can then interactively call the functions to do some testing outside of the simulator.
Regards
Michael
Please sign in to leave a comment.
Comments
2 comments