PWM Output

  • Hi
    I need to manage the pwm out to control a servo motor.
    I don't understand the use of cycle and prescale parameter and what is the range of PWM value register.
    In my case the PWM value is ignored, I use it just for stop (0) and run (1).
    Do you have an example of use


  • administrators

    @sabrus The PWM value register takes values from zero to the number in the PWM cycle register. It is basically the number pulses in logical 1. You have to calculate the values of PWM prescale and PWM cycle according to the formula to match your requested frequency.

    From the documentation: When PWM_prescale is set to 4799 and PWM_cycle is set to 100, Tc equals 10ms (100Hz). Furthermore, setting PWM value to 50 will equal 50% on frequency 100Hz.

    So eg set the PWM cycle to 100, and calculate the PWM_prescale according to your requested frequency and then you will set the PWM_value from 0 to 100 which will equal the percentage of the DO to be in logical 1 in calculated frequency.

  • I must manage the followinf motor:
    OMRON R88M-G75030H-S2-D MOT. NR
    BRUSHLESS ConnIP67 3000rpm 2,39Nm 750W

    At moment when I change the PWM value nothing happens, just stop the motor if I set to 0.
    I have set prescale to 5 and cycle to 100
    The motor set to 500 pulses to run for 360 degree

    But I can change only the speed if I change the prescale value.
    It is correct?

    Can I send a fixed number of pulses to move the servo at the specific position?


  • administrators

    @sabrus First of all if the presale is only 5 the time of the pulse is only 0.00010625 which is not a good idea... Second, right now you cannot tell Neuron to make a certain number of pulses. It is only possible to set the frequency of the pulses and percentage of the pulses to be in logical 1/0.

  • Sorry how do you get the value = 0.00010625

    About the number of pulse I think I must manage the time. Right?

  • administrators

    @sabrus Sorry it should be 0.0000125s. From the formula in the documentation. (5+1)/48000000*100 equals 0.0000125. And yes...

Log in to reply