Reverse DMX Channel Byte Order Example
Moog Animatics Class 5 SmartMotor™ DMX Guide, Rev. C
Page 40 of 46
Reverse DMX Channel Byte Order Example
This example reverses the DMX channel byte order, so that the lower DMX channel number is
loaded to a higher byte in the SmartMotor, and vice versa. See the program comments for
more details.
Also, note that there is a home to hard stop subroutine embedded in this program. It is
important to always home the motor before executing the main DMX code. For more homing
details, see Home Against a Hard Stop Example on page 30.
'==================================================================
'Reverse DMX Channel Byte Order Example
'NOTE:
'Normally, for value of "n" (for number of channels), the order is:
'DMX channel 1 (8 bit):
n=1, 0 to 255
'DMX channel 2 (8 bit):
n=2, 0 to 65535
'DMX channel 3 (8 bit):
n=3, 0 to 16777215
'However, this program will reverse the byte order to give:
'DMX channel 1 (8 bit):
n=1, 0 to 16777215
'DMX channel 2 (8 bit):
n=2, 0 to 65535
'DMX channel 3 (8 bit):
n=3, 0 to 255
'==================================================================
ADDR
=1
'Set the serial address.
EIGN
(
W
, 0)
'Disable hardware limit switch checking
'(for demo purposes).
ZS
'Clear any startup errors.
'==================================================================
'DMX control for variable settings:
b=1
'Set DMX base address - valid address: 1 thru 512
n=2
'Set the number of DMX channels to use.
'NOTE: max that may be summed is 3 or 24 bit position unsigned int.
s=10
'First motor array variable index to use starting with aw[s].
'NOTE: aw[0 thru 101] are available.
'The main WHILE loop calculates binary total value of incoming data.
m=1
'Scale Factor multiplied by data to give target position.
'NOTE: For 2 or 3 channels (16 or 24-bit position), this should be 1.
'For a single channel with 8-bit positioning, you may need to
'increase "m". Jerky motion may result by using just a single
'channel with only 8-bit resolution.
'==================================================================
'Configure DMX data usage and motor variable storage:
IF
n>3
("n too large.",#13)
END ENDIF
'Limit "n" based on a max of 3 bytes.
IF
b>(513-n)
("b too large.",#13)
END ENDIF
'Limit "b" based on max data slot.
IF
s>(102-n)
("s too large.",#13)
END ENDIF
'Limit "s" to max array value.
Содержание Class 5 SmartMotor
Страница 1: ...For the mobile version of this guide see animatics com docs guides html c5_dmx...
Страница 45: ......
Страница 46: ...PN SC80100004 001 Rev C...