How can we generate PORT1 interrupt for using mspgcc?
Hello I am having the confusion regarding to generate PORT1 interrupt.
I have attached the code below.When it compiles it gives the error like:
....................................
> "make.exe" all
msp430-gcc -mmcu=msp430xG4619 -O2 -Wall -g -c -o on.o on.c
on.c:11: two or more data types in declaration of `PORT1_service_routine'
on.c:52:1: warning: no newline at end of file
make: *** [on.o] Error 1
> Process Exit Code: 2
> Time Taken: 00:01
............................................
So i m in trouble now. Please help me with this issue.
Regards,
Sachin
// Program to turn ON the LED connected on P2.1 when external interrupt occurs
on P1.0 //
#include <io.h>
#include <signal.h>
#include <isr_compat.h>
#include <setjmp.h>
#include <msp430/common.h>
#include <msp430/gpio.h>
#include <msp430/iostructures.h>
void ISR(PORT1, PORT1_service_routine); // declaration of ISR function
before use //
int main()
{
P2SEL=0X00; // I/O Function is selected for the pin //
P2DIR=0XFF; // The port pin is switched to output direction //
P1IN=0X01; // The input is high //
P1OUT=0X00; // The output is low //
P1DIR=0X00; // The port pin is switched to input direction //
P1SEL=0X00; // I/O Function is selected for the pin //
P1IFG=0X00; // No interrupt is pending //
P1IES=0X01; // The PxIFGx flag is set with a high-to-low transition
//
P1IE=0X01; // The interrupt is enabled //
eint(); // GIE is set //
while(1)
{
P2OUT=0X00;
}
return 0;
}
ISR(PORT1,port1_service_routine)
{
dint();
if(P1IFG==0x01)
{
P1IE=0X00;
P1IFG==0X00;
P2OUT=0X02;
}
if(P1IFG==0X02)
{
P1IE=0X00;
P1IFG==0X00;
P2OUT=0X00;
}
}
---------------------------------
Heres a new way to find what you're looking for - Yahoo! Answers