Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 689 of 909
EXAMPLE:
'Example auto-addressing for four SmartMotors with SADDR command
'on an RS-232 daisy chain.
'This program code would be run at the same time
'in all motors on the chain at power-up.
ECHO 'Enable ECHO mode.
a=1 'User variable "a" to set address.
WAIT=2000 'Wait about 1/2 second to allow
'power-up to each motor.
PRINT(#128,"a=a+1 ",#13) 'Print downstream to each motor.
WAIT=2000 'Wait about 1/2 second for each
'motor to ECHO through the same
'string to the next motor.
'NOTE: At this point, each motor will have run the exact same code
'causing successive motors downstream to receive the same command
'string from the number of motors upstream.
SWITCH a 'Check the value of "a"
CASE 1
SADDR1 'Set address to 1
GOSUB10
BREAK
CASE 2
SADDR2 'Set address to 2
GOSUB20
BREAK
CASE 3
SADDR3 'Set address to 3
GOSUB30
BREAK
CASE 4
SADDR4 'Set address to 4
GOSUB40
BREAK
ENDS
END
C10 'MOTOR 1 CODE
RETURN
C20 'MOTOR 2 CODE
RETURN
C30 'MOTOR 3 CODE
RETURN
C40 'MOTOR 4 CODE
RETURN
RELATED COMMANDS:
R
ADDR=formula Address (for RS-232 and RS-485) (see page 255)
Part 2: Commands: SADDR#