Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

msp pwm control for the heater

Status
Not open for further replies.

nileshthakare2

Member level 1
Joined
Jul 16, 2011
Messages
34
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,618
Hi
I am implementing PID controller for the heater.I have got some value by ADC according to that value i want to made the changes in the duty cycle in MSPf2274 controller. If anyone have the code of PWM please share with me.I have also implement the PWM code if anyone knows problem with this code that also told me.


void PWM ( double rDelta) //heater control Function) // rDelta is thye value from the sensor=> PID=>

{
// WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x02; // P1.2 and P1.3 output
P1SEL |= 0x02; // P1.2 and P1.3 TA1/2 otions
TACCR0 = 256; // PWM Period/2
TACCTL1 = OUTMOD_6; // TACCR1 toggle/set
TACCR1 = rDelta; // TACCR1 PWM duty cycle
//TACCTL2 = OUTMOD_6; // TACCR2 toggle/set
//TACCR2 = 96; // TACCR2 PWM duty cycle
TACTL = TASSEL_1 + MC_3; // ACLK, up-down mode

__bis_SR_register(LPM3_bits); // Enter LPM3

}


Thanks in advance
Nilesh
 

I think your code is correct. just check out whether it gives any errors and let me know.
 

Hi,
this is my code.

void PWM () //pwm function)

{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT

P2DIR |= 0x04; //port 2 pin p2.2 dir and sel both are 1 then ta0 bit is working

P2SEL |= 0x04; // P2.2 TA0/2 otions

TACCR0 =512; // PWM Period/2
TACCTL0 = OUTMOD_3; // TACCR2 toggle/set
TACCR1 = 384;

TACTL = TASSEL_2 + MC_3; // smclck, up-down mode

__bis_SR_register(LPM3_bits); // Enter LPM3

}

i have not got any PWM on port pin 2.2 . Whats the problem in the setting ?
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top