Shop OBEX P1 Docs P2 Docs Learn Events
PWMPAL and Servos — Parallax Forums

PWMPAL and Servos

Rich GreenRich Green Posts: 11
edited 2006-02-27 18:34 in Robotics
In Nuts and Volts column # 100 Jon explains:

"Let's say, for example, we want to control a servo and start with it centered. Knowing what we
know about servos, we need the on-time to be 1.5 milliseconds and the off-time to be 20
milliseconds. The rest is simple math: 1.5 milliseconds divided by 0.025 milliseconds (25
microseconds) is 60. This will be our on-time count. Next we take 20 milliseconds and divide by
0.025 milliseconds to get 800."

He then goes on:

"If we want to connect the servo to P15, here's the command to send the centering counts:
SEROUT 0, 6, [noparse][[/noparse]"!PWMM4", 60, 0, 32, 3]"

Try as I might, I can't figure out how 332 relates to 20 milliseconds or 800.

Can anyone help me to understand this?
·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-27 05:54
    That's not 332, it's 3 x 256 + 32 --> 800 x 25 uS = 20 ms. You might want to have a read of the PWMPAL docs for details.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Rich GreenRich Green Posts: 11
    edited 2006-02-27 18:34
    Thanks Jon, it was the 3X256 that I was missing.· Somehow I saw these as Decimal numbers, don't know why.



    Rich Green
Sign In or Register to comment.