hsmoke detector connected to ED at P2.0 ?..Please Help

Thread Starter

dorina

Joined Jul 3, 2011
2
Hello, I have to do a project using TI Ez430 rf2500 kit with msp430f2274uc..,from the start I want so say that I am new with microcontrollers and C but i am willing to learn.
I want to do a project with a smoke detector which gives a ttl signal to the END DEVICE(0L for detecting smoke),I want to put this signal to port P2.0 at pin 3, and transmit it to ACCESS POINT,where I have set P2.0. as an output so it can give a signal that can trigger a buzzer.
i succeeded in making the wireless communication between AP and ED using an interrupt at port1 by pressing the button on ED and blinking the red led on AP and triggering the buzzer.
Now..I understood that only port1 and 2 have interrupt capability..but there is a problem in using an interrupt at port 2 because in mrfi.boards.c is defined BSP_ISR_FUNCTION which defines a Port2 interrupt service routine and I have defined another Port2 ISR in my code..so it didn't work..
I have read in some posts that if I comment the BSP_ISR_FUNCTION from mrfi.boards.c it can work my ISR defined at port 2 from my ED.c file ..but it didn't..,I mean when I power up the device it stays like in an interrupt with red led on..only
And if I put my ISR in mrfi.boards.c , like in the code below,I have the the green led on(which I want,it says no interrupt happenened,even if it doesn't toggle)but in the same time red led on,even if I don't put the signal from the smoke detector(my smoke detector gives a 0L when smoke was detected at P2.0)and when I put the signal at P2.0 nothing happens,no toggle..nothing.
Code for ED :
#include "msp430x22x4.h"
#include "mrfi.h"
unsigned int i;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR = 0x03; // P1.0-P1.1 as output

P2SEL=0x00;
P2DIR=0x00;
P2IES=0x01;
P2IE=0X01;

BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALBC1_1MHZ;
BCSCTL3 |= LFXT1S_2;
MRFI_Init();
MRFI_WakeUp();
MRFI_RxOn();

for(;;)
{P1OUT ^=0x02;//toggle green
i=60000;
do(i--);
while(i!=0);
}

}
void MRFI_RxCompleteISR()
{
P1OUT ^= 0x01;//toggle red

}
And my modification in mrfi.boards.c :

#pragma vector=PORT2_VECTOR
__interrupt void Port2_ISR(void)

{
mrfiPacket_t packet;
packet.frame[0]=8+20;
MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED);

P2IFG &= ~0x00; //
MRFI_GpioIsr();
}
I want when I power up the ED ,to toggle its green led and when smoke is detected to toggle its red led and transmit it to the AP making his red led to toggle as well.
Thanks in advance for any information you could give me.
Have a nice day.
 
Top