AnsweredAssumed Answered

Need help on controlling speed of a motor using PWM

Question asked by Guest on Feb 23, 2009
Latest reply on Feb 23, 2009 by Erich Styger

Hi. I'm using a MC9S08AW60 MCU. Below is part of the code for controlling the speed of a DC motor using PWM. The motor is able to rotate but I'm not sure how to control the speed.

 

  TPM1SC=0x00;
  TPM1MOD=0x0800;
  TPM1C0V=0x0666;   //driverB    
  TPM1C1V=0x0666;   //driverA  
  TPM1SC=0x08;
  TPM1C0SC=0x00;  
  TPM1C1SC=0x00;

 

Can anyone advice me which parts of the above code controls the speed? This code is not written by me, so I'm quite clueless on this. Below is the link to the MCU datasheet. The PWM topic is at chapter 10. Thx

 

http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S08AW60.pdf?fpsp=1

Outcomes