Shop OBEX P1 Docs P2 Docs Learn Events
Servo Driver (Standard, Continuous, High-Speed) — Parallax Forums

Servo Driver (Standard, Continuous, High-Speed)

Here is a driver for up to 64 servos. Does not support feedback servos. 50 Hz controls. Uses mode 4 smart pins.

The demo builds a table of pin numbers, one for each servo. It then calls start(NumberServos, @Table), which starts a PASM2 cog. This is the actual driver. It computes the period allocated to each servo (20 Millisec / NumberServos). It then fetches the pin numbers, builds an internal list, and defaults the pulse width to 1500 microseconds. The pulse width occupies the same table that was used to pass the pin numbers; the user program can vary the pulse width for any given servo by simply writing to the table. The PASM driver cycles through the list every 20 milliseconds, using the pulse width values supplied by the user program.
The screen shots show pulses supplied to 6 servos. SixServos shows the case when a total of six servos are driven; the pulses are distributed over the 20 millisecond period. FiftyTwo servos shows the case where 52 servos are being driven; the six (adjacent) servos are grouped together and overlap a lot.

Sign In or Register to comment.