Summary: Lab 5 will discuss what interrupts are for and how to fire them.
Write a function, void seg_count(int num), similar to the LED counting function, led_num(), from Lab 4. In this case, the function will display a number between 0 and 15 on the seven-segment display in hex.
The pin-outs for the blue MSP430F16x Lite Development Board are configurable through a programmable PLD. This allows the user to change the pin map in software. You can see the current arrangement of the pins here: LiteBoardPinout
Using the seg_count() function you just wrote. Write a program that does the following:
Interrupts, as the name implies, will interrupt a program whenever it is, and when the interrupt is done being serviced it will jump back to wherever it was in the program. This allows the programmer to have more freedom in their code, automates certain functions, and reduces the number of checks handled by the processor.
In order to fire an interrupt, the following must be done:
A typical program using interrupts will look like the following piece of code:
void main(void){
_EINT(); //Enables interrupts globally
//... more code
}
void SOME_interrupt (void) __interrupt[SOME_vector]{
//...more code that runs once interrupt fires
return;
}
Interrupt Vectors section.
Write an interrupt that will fire when the buttons are pushed. If you need additional help, there are examples in the ../Crossworks MSP430 1.x/samples/ directory.
Modify the program from Problem 1 so that it is interrupt based and does not poll for the buttons being pushed. How does your program behavior changes? When would you want to use polling over using an interrupt?
"This lab discussed interrupts and how to implement them."