beautypg.com

Serial output (mini maestro 12, 18, and 24 only), D. script specifications – Pololu Maestro User Manual

Page 64

background image

Serial output (Mini Maestro 12, 18, and 24 only)

On the Mini Maestro 12, 18, and 24, a script can be used to send serial data out on the TTL-level serial port (TX). This
means that the Maestro can control additional Maestros, allowing for large numbers of channels without a separate
microcontroller. Here is a simple program that shows how a serial command can be used to control another Maestro.
To use this code, configure both Maestros in UART mode at the same baud rate, and connect TX on the master to RX
on the slave.

100 delay # initial delay to make sure that the other maestro has time to initialize

begin

127 0 mini_ssc # set servo 0 to position 127, using the mini-SSC command

254 0 mini_ssc # set servo 0 to position 254

repeat

sub mini_ssc

0xFF serial_send_byte serial_send_byte serial_send_byte

return

6.d. Script Specifications

The user scripting language available on the Mini Maestros is more powerful than that available on the Micro
Maestro. The differences are summarized in the table below.

Micro Maestro

Mini Maestro 12, 18, and 24

Script size:

1KB

8 KB

Stack size:

32

126

Call stack size:

10

126

Number of subroutines:

128

unlimited

Extra commands:

PEEK, POKE, PWM, SERIAL_SEND_BYTE

Script size: This is the number of bytes of persistent memory that can be used to store your code. A bigger script size
allows you to store more servo motion frames and to write more complex programs.

Stack size: This is the maximum number of values that can be on the stack at the same time. A bigger stack allows
you to have more variables, do bigger computations, and worry less about whether the stack will overflow.

Call stack size: This is the maximum subroutine nesting depth (the maximum number of subroutines that can be
called without returning).

Number of subroutines: This is the number of different subroutines you are allowed to have.

The first 128 subroutines defined in your script are special: these subroutines can be started using a serial or native
USB command, and each call from within your script requires only one byte of script space. The Micro Maestro
only supports having up to 128 subroutines. The Mini Maestro 12, 18, and 24 support having an unlimited number
of subroutines, but the subroutines defined after the first 128 can not be started from a serial or native USB command,
and each call requires 3 bytes of script space.

Pololu Maestro Servo Controller User's Guide

© 2001–2014 Pololu Corporation

6. The Maestro Scripting Language

Page 64 of 73