Hello everyone,
I'm new on MSP LaunchPad kit and I'm trying to setting a LED through a BC transistor. This is a test to, later, activate a DC motor through the smae mechanism.
So, this is the schematic:
And the code:
#include "msp430g2452.h"
void main(void){
WDTCTL = WDTPW + WDTHOLD; //Turn off Watchdog timer
P1DIR = 0xFF; // All pins are outputs
CCTL0 = CCIE; // Enable timer A comparator interrupt
TACTL = TASSEL_2+MC_3+ID_3; // SMCLK = 1 MHz, SMCLK/8 = 125 KHz (8 us)
CCR0 = 62500; // Up/Down mode
// Each interrupt occurs at 2 * 62500 * 8us = 1s
_BIS_SR(GIE);
while(1);
}
// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void){
P1OUT = P1OUT ^ 0x01; // Alternates logic level in P1.0
}
So, the kit LED (P1.0) keeps blinking correctly, but the external LED doesn't. It keeps activate all the time. Even if i connect the base of the transistor to the GND pin on the MSP, it doesn't light off the LED. I'm powering the MSP through the USB cable on the PC and the code was made on the IAR IDE.
Can anyone tell me what I'm doing wrong?
Thanks.