Hey guys,
I'm somewhat new to programming microcontrollers. I mean I've taken a course before on programming an MSP430, but I was using a different kit then, and now I am workign with the ez430-RF2500 development kit. I'm having a lot of trouble understanding, especially the wireless communication. I've never dealt with wireless microcontroller programming.
I just wanted to start this thread as a way for me (and maybe others) to find help on this particular kit.
And please try and be patient with me, again I'm quite new so you can expect A LOT of stupid question from me on this issue.
As for my first question, it's a very simple one. I've basically started developing on the kit from scratch, and I've been doing something very simple with it, like lighting LEDs and such. I'm now trying to get the button to work which I can't seem to do. Here is a piece of my code:
#include "msp430x22x4.h"
void getBtn(void);
void LEDOn(void);
void LEDOff(void);
void LEDRed(void);
void LEDGreen(void);
void swDelay(unsigned int cnt);
int hitkey, i;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
while(1)
{
hitkey = 0;
LEDOff();
while (hitkey == 0)
{
getBtn();
}
if (hitkey != 0)
{
// Do stuff here
}
}
}
void getBtn(void)
{
P1DIR &= ~(BIT2); // Set P1.2 to input direction
P1SEL &= ~(BIT2); // P1.2 set to I/O option
hitkey = P1IN & BIT2; // AND with BIT2 to get just the value of P1.2
}
It's quite simple what I am trying to do. Maybe at the hit of the button I light some LED's or something, but the problem is that when I push it, nothing happens. The breakpoint never hits the next statement. Does anyone know the reason why?
The second question I have is how I can write the interrupt for the button? It's quite primitive I understand, how I have the code written now, but I wasn't quite sure on how to write the interrupt for this.
Thanks in advance for your help.