Need help on controlling speed of a motor using PWM

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Need help on controlling speed of a motor using PWM

ソリューションへジャンプ
1,738件の閲覧回数
admin
Specialist II

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

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
870件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hello,

first off, you will need something which measures the speed of the motor. Typically optical shaft encoders are used for this:

http://engknowledge.com/shaft_absolute_encoder_gray_code.aspx

 

Then, you can use a closed loop control algorithm like this one:

http://en.wikipedia.org/wiki/PID_controller

 

Good luck!

 

BK

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
871件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hello,

first off, you will need something which measures the speed of the motor. Typically optical shaft encoders are used for this:

http://engknowledge.com/shaft_absolute_encoder_gray_code.aspx

 

Then, you can use a closed loop control algorithm like this one:

http://en.wikipedia.org/wiki/PID_controller

 

Good luck!

 

BK

0 件の賞賛
返信