Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MSP430 Microcontroller Help

Status
Not open for further replies.

cszym001

New Member
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
 
no interrupt service routines? In a lot of 430 code, everything is done in ISRs. I would set up an interrupt handler for the timer that reads the adcs and sets the new pwm params. It's a bit more complex than that but there are adc code samples on the ti site that you can use. It's complicated because there is only one timer and it drives the PWM but you can use the interrupt from that.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top