// initializes MSP 430 and the other electronics void initialize() { // stop watch dog timer WDTCTL = WDTPW + WDTHOLD; // set CPU clock speed BCSCTL1 = _BCS_CLK; DCOCTL = _DCO_CLK; // set launchpad board LED and button pin directions P1DIR_bit.P0 = _OUTPUT; P1DIR_bit.P3 = _INPUT; P1DIR_bit.P6 = _OUTPUT; // turn on internal pull-up resistor for launchpad push button P1REN_bit.P3 = _HIGH; // configure for fuel cell car _initMotorController(); #ifdef _RESET_MOT_CNTL _resetMotorController(); #endif _initADC(); // set switch pin direction P2DIR_bit._P_SWITCH = _INPUT; // set LED light bar pin directions to output P2DIR |= _LED_MASK; //enable the elapsed time timer resetTimer(); __enable_interrupt(); // enable global interrupts }
int getANX (char channel){ _initADC(); int result = ReadADC10(channel - 1); return result; }