Other Parts Discussed in Thread: MSP430F5529
Hello,
I try to control a servo motor using the MSP430F5529 microcontroller as following :
Servo_Frequency ==> 50 Hz 1 ms ====> 0 degrees 1.5 ms ====> 90 degrees 2 ms ====> 180 degrees
I use the TIMER A2 in order to generate the needed pwm signal.
TA2CCR0 = (1500 000 / 50 ) /* CLOCK = 12000 000 , but I use a prescaler of 8 */
TA2CTL |= TASSEL_2 | ID_3 | MC_1 | TACLR; /* SMCLK, prescaler = 8, mode couter up, timer clear*/
TA2CCTL1 |= OUTMOD_7 | CCIE; /* reset/set | enable interrupt */
TA2CCR1 |= 1980; /* this value is calculated with the following formula :*/
/* this should turn the servo motor to left */
0.001s = Duty% * FRQ(s)
FRQs = 1 / 1500 000 = 0.00000066
Duty% = 0.001 / 0.00000066
Duty% = 1515.151
Duty% = TA2CCR0 / TA2CCR1 /* Am I right ?*/
==> TA2CCR1 = 1980 /* according to the 1ms , means the servo motor should start from the 0 degrees*/
So, despite of this calculations , the servo motor doesn't work.
Could someone help me with this ?