Position Mode Control Example
Moog Animatics Class 5 SmartMotor™ DMX Guide, Rev. C
Page 32 of 46
Position Mode Control Example
The following example is provided to help you understand position mode control through DMX
code. It is recommended to use three DMX channels for maximum position resolution.
However, just one channel may be used.
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.
'==================================================================
'Position Mode Example Code
'==================================================================
ADDR
=1
'Set motor serial address as needed.
'This does not affect DMX address.
ECHO
'Set ECHO on,
not required for DMX.
EIGN
(W,0)
'Disable hardware limit switch checking
'(for demo purposes).
ZS
'Clear any startup errors.
'Variables for DMX control:
b=1
'Set DMX base address (valid address: 1 through 512).
n=3
'Set number of DMX channels to use.
'NOTE: Max that may be summed is 3 or 24-bit position unsigned int.
s=0
'First motor array variable index to use starting with aw[s].
'NOTE: aw[0 thru 101] are available
'NOTE: Data ranges for the value of "n" for number of channels are:
'n=1
0 to 255
'n=2
0 to 65535
'n=3
0 to 16777215
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.
q=b+n-1
'Last data channel used (will be trigger when data received).
COMCTL
(1,b)
'Set base DMX channel to value from CADDR.
COMCTL
(2,n)
'Accept one DMX channel of data.
COMCTL
(3,q)
'Status word 12 bit 2 will be set to the value 1
'when channel "q" arrives.
COMCTL
(4,s)
'Set start of array index storage (good for
'bypassing cam mode dynamic array).
Содержание 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...