Professional Documents
Culture Documents
MSP430 Polling Vs Interrupt
MSP430 Polling Vs Interrupt
POSTED BY
GANESHREDCOBRA
POSTED ON
NOVEMBER 8, 2012
POSTED UNDER
1 COMMENT
In this example other than the usual polling method we uses an interrupt to get the switch reading
In MSP430 port1 interrupt service routine is wrien like this
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
I used code composer studio to get the output of interrupt codeThe mspgcc interrupt service routine is like this but i
failed to get the output using mspgcc
This example also reads switch and toggles lightThis is the full code of the interrupt program..
/*interrupt.c
ganeshredcobra@gmail.com
GPL
*/
#include <msp430g2553.h>
#define LED1 BIT0
#define LED2 BIT6
#define BUTTON BIT3
volatile unsigned int i;//to prevent optimization
void main(void)
{
WDTCTL=WDTPW+WDTHOLD;
P1DIR |= (LED1+LED2);//
P1OUT &= ~(LED1+LED2);
P1IE |= BUTTON;
P1IFG &= ~BUTTON;
CCS (hps://importgeek.wordpress.com/tag/ccs/)
code composer studio (hps://importgeek.wordpress.com/tag/code-composer-studio/)
Embedded Linux (hps://importgeek.wordpress.com/tag/embedded-linux/)
Embedded systems (hps://importgeek.wordpress.com/tag/embedded-systems/)
GPIO Programming (hps://importgeek.wordpress.com/tag/gpio-programming/)
MSP430 Launchpad (hps://importgeek.wordpress.com/tag/msp430-launchpad/)
polling (hps://importgeek.wordpress.com/tag/polling/)
Reply