0°~180° Servo
利用PWM控制角度
Most servo motor will work well on 50 Hz of PWM frequency;
this mean the PWM signal should have a period of 20ms.
This servo can operate 180° when given a pulse signal ranging from 600usec to 2400usec.
#define MIN_PULSE_WIDTH 600 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
#define REFRESH_INTERVAL 20000 // minumim time to refresh servos in microseconds
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
#define REFRESH_INTERVAL 20000 // minumim time to refresh servos in microseconds
--------------
360° Servo
利用PWM控制轉的方向與轉速
360° servo 是藉由0.5~2.5ms HIGH PULSE
50Hz的脈波訊號做控制霢1.5ms HIGH PULSE是
位於停止的狀態;小於1.5ms 時順時霢轉動霢愈
小愈快;大於1.5ms 時霢時霢轉動霢愈大愈快。
------------------
S3C6410 的PWM 如何設定,才能得到20ms的週期 (50HZ)
如果 PCLK=83MHZ, 8-bit prescaler=255 and 4-bit divider=16
Frequency=PCLK/(255+1)/16 => 20.2KHz
1/20.2K=0.0495ms
20ms/0.0495=404 --> TCNTB
TCMPB setting?:
Get 2ms High Pulse width: 2ms/0.0495=40
Get 1.5ms High Pulse width: 2ms/0.0495=30
Get 1ms High Pulse width: 1ms/0.0495=20
沒有留言:
張貼留言