I am a beginner coder learning on the MSP430FR4133. I'm using a servo motor as part of my system, which is controlled by PWM.
The motor rotates across 180°, with a 1ms pulse being far right and 2ms pulse being far left in a 20ms period. Unfortunately I'm simply having no success operating it.
I have some very simple code that my intention was to simply force the motor to the right-most position:
WDTCTL = WDTPW | WDTHOLD;
P1DIR |= BIT7; //P1.7 Output
P1SEL0 |= BIT7; //P1.7 Select
TA0CCR0 = 20000-1; //Set Period to 20ms.
TA0CCTL1 = OUTMOD_7; //CCR1 Reset/Set
TA0CCR1 = 1000; //Set Duty Cycle to 1ms
TA0CTL = TASSEL_SMCLK | MC_UP | TACLR; //Use SMCLK in Up Mode
Unfortunately, the code isn't operating as I intended. The motor is supplied by a 5v supply, though the PWM signal from the MPS430 is only 3.3v. Could this also be an issue?
Thanks for any assisstance, and I can expand on anything I have not given enough information on.