P
ar
t
1: P
rog
ra
m
ming
Moog Animatics SmartMotor™ Developer's Guide, Rev. L
Page 108 of 909
function = 16:
Set the SDO command timeout period. In milliseconds. Range 10 to 1000.
Default is 500 (1/2 second).
function = 17:
Enables the master commands: NMT, SDORD and SDOWR. Enable simple
master: x is the value 3; disable master: x is the value -1.
For more details, see CANCTL(function,value) on page 354.
Specific features are based on the fieldbus network being used. See the corresponding
SmartMotor fieldbus guide for more details.
SDORD(...)
Read value from SDO
The SDORD command gets (reads) the value from the specified SDO on a specified device.
EXAMPLE:
Read an SDO
x=
SDORD
(1, 24592,0,2)
' Read 2 bytes from address 1,
' object 0x6010, sub-index 0.
e=
CAN
(4)
' Get any error information
y=
SDORD
(1, 24608,0,2)
' Read 2 bytes from address 1,
' object 0x6020, sub-index 0.
ee=
CAN
(4)
' Get any error information
IF
(e|ee)==0
' Confirm the status of both SDO operations.
' Success
b=x
' Set some example variable according
c=y
' to the data received.
GOSUB
(3)
' Some routine to take action when this data is valid.
ELSE
GOSUB
(8)
' Go do something to deal with error when read fails.
ENDIF
For more details, see SDORD(...) on page 692.
SDOWR(...)
Write value to SDO
The SDOWR command writes a value to the specified SDO on a specified device.
EXAMPLE:
Write an SDO
a=1234
SDOWR
(1,9029,0,4,a)
' Write 4 bytes to address 1,
IF
CAN
(4)==0
' Confirm the status of the most recent SDO operation.
' Success
GOSUB
(4)
' Some routine to take action when the write succeeds.
ELSE
GOSUB
(9)
' Go do something to deal with error when write fails.
ENDIF
For more details, see SDOWR(...) on page 694.
Part 1: Programming: SDORD(...)