This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2553: Defining constants

Part Number: MSP430G2553

Hi,

Below is some code that i'm writing. I'm not sure why but if I write BUTTON next to where the //<*******Help********* is there is always a compiler error. If I write BIT5 for example in its place it works fine. Someone explain please! thanks in advance, Bal

#include <msp430g2553.h>

//****Definitions****************

#define pin_5_on P1OUT = P1OUT |= BIT0;//LED segments...Pin 5 on P2 connector ON
#define pin_5_off P1OUT = P1OUT & ~BIT0; //Pin 5 on P2 connector OFF
#define pin_6_on P1OUT = P1OUT |= BIT1;//LED segments...Pin 6 on P2 connector ON
#define pin_6_off P1OUT = P1OUT & ~BIT1; //Pin 6 on P2 connector OFF
#define pin_8_on P1OUT = P1OUT |= BIT2;//LED segments...Pin 6 on P2 connector ON
#define pin_8_off P1OUT = P1OUT & ~BIT2; //Pin 6 on P2 connector OFF
#define pin_11_on P1OUT = P1OUT |= BIT3;//LED segments...Pin 6 on P2 connector ON
#define pin_11_off P1OUT = P1OUT & ~BIT3; //Pin 6 on P2 connector OFF
#define pin_15_on P1OUT = P1OUT |= BIT4;//LED segments...Pin 6 on P2 connector ON
#define pin_15_off P1OUT = P1OUT & ~BIT4; //Pin 6 on P2 connector OFF

#define BUTTON BIT5;

void main(void) {
    WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer
    P1DIR |= 0x1F;//00011111
    P2DIR |= 0xF8;//11111000
    P1OUT &= 0x00;//Initialise port 1 to zero output.
    P2OUT &= 0x00;//Initialise port 2 to zero output.
    pin_5_on;//Pin 5 on P2 connector ON
    pin_5_off;//Pin 5 on P2 connector OFF

       if (!(P1IN & BUTTON))//<*******Help*********
		{
			pin_5_on;
		}
		else
		{
			pin_5_off;
		}
    }

**Attention** This is a public forum