Attaching a Servo motor to the EasyLab

From ErikaWiki

Jump to: navigation, search

Currently the PWM Block for the EasyLab board has a limited support in frequencies, making it impossible to have the 50Hz PWM needed to control a servo.

As a workaround, it is possible to do the following (hint provided by Chin Luh from Tritytech):

  1. hardcode the 50 in easylab_pwm.c
  2. change P1TCONbits.PTCKPS = 0b11; and EE_UINT16 ptper = EE_get_peripheral_clock() / pwm_freq / 64; in ee_pwm.c.
  3. resulting input vs. degree:
    1. 0.025  : 0 degree
    2. 0.0725 : 90 degree
    3. 0.12  : 180 degree
Personal tools