Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 841 of 909
CAN Bus - I/OBlock with PDOPoll
This program communicates with a Softlink model RT133-3HF00-CAN I/Oblock. It uses high-
speed PDOpolling following the default mapping found in the .eds file. Also, the slave detects
the baud rate.
NOTE: This example uses high-speed PDO polling. For applications that do not
require high-speed polling, see CAN Bus - Timed SDOPoll on page 840.
' NOTES:
' - Using Softlink RT133-3HF00-CAN
' - Using the default PDO mapping found in .eds file
' - Master address is 1, slave address is 15, slave detects baud rate
ADDR=1
CADDR=1
CBAUD=125000
'RUN?
EIGN(W,0) ZS
SILENT
' Enable master
CANCTL(17,3)
' Make sure in pre-op (not operational)
NMT(0,128)
' Change analog output from +/-10V voltage(4) to 4-20mA(5)
SDOWR(15,8192,13,1,5)
' Disable transmit and receive PDO for master to allow changing
' Set bit 31
a=-2147483648 ' 0x80000000
SDOWR(1,5120,1,4,a) ' 0x1400 rx
SDOWR(1,6144,1,4,a) ' 0x1800 tx
SDOWR(1,5121,1,4,a) ' 0x1401 rx
SDOWR(1,6145,1,4,a) ' OX1801 tx
' Set mapping number of entries to 0
ab[0]=0
SDOWR(1,5632,0,1,ab[0]) ' 0x1600 rx
SDOWR(1,6656,0,1,ab[0]) ' 0x1a00 tx
SDOWR(1,5633,0,1,ab[0]) ' 0x1601 rx
SDOWR(1,6657,0,1,ab[0]) ' 0x1a01 tx
' Set mapping objects
' ab[2] 0x2220 03 08
a=572523272
SDOWR(1,5632,1,4,a) ' 0x1600 rx
' ab[3] 0x2220 04 08
a=572523528
SDOWR(1,6656,1,4,a) ' 0x1a00 tx
' aw[32] 0x2221 01 10 ' aw[32] is 1st analog voltage input
Part 3: Examples: CAN Bus - I/OBlock with PDOPoll