0

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.

RDA
  • 1
  • 1
  • 3.3 is a TTL Level that will be represented as a high, are you pins correctly configurated?? – ΦXocę 웃 Пepeúpa ツ Apr 05 '16 at 18:26
  • 1
    TTL level is 5v. If it appears to be less using an analog voltmeter, that is because of the PWM duty cycle. – Weather Vane Apr 05 '16 at 18:30
  • Did you connect servo directly to microcontroller's pin? – fukanchik Apr 05 '16 at 18:34
  • Servo control signal is connected directly to microcontroller's pin. The supply of the servo is an external battery pack. – RDA Apr 05 '16 at 18:38
  • the signal and the +12 volts must share a common ground. so a separate battery pack is probably not the right way to wire it. Suggest connecting the serve VE+ voltage to the same line as is powering the MSP430 and the ground to the same line as the MSP430 – user3629249 Apr 06 '16 at 02:02
  • MSP430 pins generally source 3.3v. Do you have an oscilloscope? It would be helpful to check if you are really generating the signal you think you are generating. I don't see your BCSCTL calibration settings so your timing might not be what you think it is. – HeadCode Apr 06 '16 at 15:45
  • Also, I don't have the FR4133 header but of all the headers I do have I couldn't find MC_UP in any of them. Try using MC1. The default mode is the counter is stopped, so that might be what is happening. – HeadCode Apr 07 '16 at 03:51

0 Answers0