Hi
I have a MSP430x2013 Microcontroller and I want to do two things. First accept to analog voltage inputs and second based on those inputs send out a PWM signal. One input varies the duty cycle. The other the Period. The program I currently have covers the PWM signal output portion but not the constant acquisition and updating the PWM signal output. Can someone help with this? Here is my current code:
#include <msp430x20x3.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x04; // P1.2 output
P1SEL |= 0x04; // P1.2 TA1/2 options
CCR0 = 512-1; // PWM Period
CCTL1 = OUTMOD_7; // CCR1 reset/set
CCR1 = CCR0/2; // CCR1 PWM duty cycle
TACTL = TASSEL_2 + MC_1; // SMCLK, up mode
_BIS_SR(CPUOFF); // Enter LPM0
}
Thanks
Chris