Hi,
I have the MSP430 F2013 (eZ430-F2013) Demo/evaluation kit.
I am trying to make a project that runs the LED through a timer PWM output so i can change the speed at which it is turned ON/OFF and the brightness.
The following code works and basically makes the LED turn ON/OFF using a software delay: -
#include "msp430.h"
volatile unsigned int i; // volatile to prevent optimization
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= 0x01; // Set P1.0 to output direction
for (;;)
{
P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR
while( i != 10000)
{
i++;
}
i=0;
}
}
Quick question what is this include file?
#include “msp430.h”
and as i am using a F2013 do i need a different include file?
Back to my problem i have tried using the following code to switch the LED ON?OFF but it does not work, all that happens is that the LED stays on all the time CAN ANYBODY HELP?
#include <msp430x20x3.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x01; // P1.2 and P1.3 output
P1SEL |= 0x01; // P1.2 and P1.3 TA1/2 otions
CCR0 = 128; // PWM Period/2
CCTL1 = OUTMOD_6; // CCR1 toggle/set
CCR1 = 32; // CCR1 PWM duty cycle
TACTL = TASSEL_1 + MC_3; // ACLK, up-down mode
_BIS_SR(LPM3_bits); // Enter LPM3
}
Thanks,
Xplosiv