nileshthakare2
Member level 1
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 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