P
ar
t
1: P
rog
ra
m
ming
Moog Animatics SmartMotor™ Developer's Guide, Rev. L
Page 104 of 909
a=ADDR
Motor’s Self Address
If the motor’s address (ADDR) is set by an external source, it may still be useful for the
program in the motor to know to what address it is set. When a motor is set to an address, the
ADDR variable reflects that address — the range is from 1 to 120.
Communicating over RS-485
Multiple SmartMotors can be connected to a single host port by connecting their RS-485 A
signals together and B signals together, and then connecting them to an RS-485 port or to an
RS-232 or USB adapter.
Adapters provided by Moog Animatics have built-in biasing resistors. However, extensive
networks should add bias at the very last motor in the chain. The RS-485 signals of the
SmartMotor share I/O functions and are not properly biased for more than just a few
SmartMotors. Additionally, proper cabling would include a shielded twisted pair for
transmission.
The main RS-232 ports of the
D-styleSmartMotors can be
converted to RS-485 and isolated
using Moog Animatics adapters.
The RS-232 and RS-485 ports have many configuration possibilities. To set the configuration
options, use the OCHN command, which is described in the following section.
Using Data Mode
Data mode is used to retrieve data from the RS-232/RS-485 port.
If a communications port is in Command mode, then the motor responds to arriving
commands it recognizes. However, if the port is opened in Data mode, then incoming data fills
the 16-byte buffer until it is retrieved with the GETCHR command.
For D-style motors:
a=LEN
Number of characters in RS-232 buffer
a=LEN1
Number of characters in RS-485 buffer
a=GETCHR
Get character from RS-232 buffer
a=GETCHR1
Get character from RS-485 buffer
For M-style motors:
a=LEN
Number of characters in RS-485 buffer
a=GETCHR
Get character from RS-485 buffer
The buffer is a standard FIFO (First In First Out) buffer. This means that if the letter A is the
first character the buffer receives, then it will be the first byte offered to the GETCHR
command. The buffer exists to make sure that no data is lost, even if the program is not
retrieving the data at just the right time.
The GETCHR buffer will stop accepting characters if the buffer overflows, and RLEN will stop
incrementing. Also, the overflow bit will be set for that serial channel. When the buffer is
Part 1: Programming: a=ADDR