Module servo
- Servo wrapper functions
Servo wrapper functions.
Index
-
Protocol
SERVO
- Servo control protocol-
Tag
div
- Number of divisions in the span between max - min -
Tag
frequency
- Frequency of the servo pulse -
Tag
max
- Maximum time active; in microseconds -
Tag
min
- Minimum time active; in microseconds -
Tag
pos
- Positition of the servo; This is what you will be using the most -
Tag
start
- Starts servo operations -
Tag
stop
- Supposed to stop servo operations -
Tag
usec
- Number of microseconds (greater than min ) the pulse to the servo will last
-
Tag
-
Process
servo
- General servo control -
Process
simple.servo
- Stepping-stone servo control process
Declarations
servo.module
:27Protocol SERVO
PROTOCOL SERVO
Servo control protocol.
servo.module
:31Tag max
max ; INT
Maximum time active; in microseconds.
Parameters:
INT |
max |
Initially 2300. must be less than frequency . |
servo.module
:34Tag min
min ; INT
Minimum time active; in microseconds.
Parameters:
INT |
min |
Initially 700. must be more than 0. |
servo.module
:37Tag div
div ; INT
Number of divisions in the span between max
- min.
Parameters:
INT |
div |
Initially 180. Must be <= max - min . |
servo.module
:40Tag pos
pos ; INT
Positition of the servo; This is what you will be using the most.
Parameters:
INT |
pos |
Initially 90. Must be between 0:pos . |
servo.module
:47Tag usec
usec ; INT
Number of microseconds (greater than min
) the pulse to the servo will last.
We strongly recommend using [@code div] and [@code pos] to effect the position of the servo.
Parameters:
INT |
usec |
Automatically calculated when pos is reset. |
servo.module
:53Tag frequency
frequency ; INT
Frequency of the servo pulse.
Do not change this casually. Most servos require a pulse once every 20 milliseconds, which is what frequency
defaults to.
Parameters:
INT |
frequency |
Initially 20000. Measured in microseconds. |
servo.module
:59Tag start
start
Starts servo operations.
We recommened setting div
and pos
before sending the start
signal, and not changing div
after.
servo.module
:62Tag stop
stop
Supposed to stop servo operations. We've not added that functionality yet.
servo.module
:75Process servo
PROC servo (VAL INT board.pin, CHAN SERVO s?)
General servo control. Pass a PWM pin and SERVO channel into this process, and all signals sent over the channel will be acted upon properly.
Parameters:
VAL INT |
board.pin |
The board pin to be used for servo operations. For the time being, only PWM pins connected to a 16 bit timer can be used to operate servos. |
CHAN SERVO |
s |
The servo channel used for controlling servo operations. |
servo.module
:151Process simple.servo
PROC simple.servo (VAL INT board.pin, CHAN BYTE p?)
Stepping-stone servo control process. The idea is this is a simpler process to work with servos than the PROTOCOL. You need to know your servo's bounds for this one, but it does allow for a single-channel servo control.
Parameters:
VAL INT |
board.pin |
The board pin to be used for servo operations. For the time being, only PWM pins connected to a 16 bit timer can be used to operate servos. |
CHAN BYTE |
p |
The input BYTE channel for setting the position of the servo. This is hard-coded to be a range from 0 to 180. Do not attempt to send anything outside of that range. |