P
ar
t
2: C
omman
d
s
Moog Animatics SmartMotor™ Developer's Guide, Rev. L
Page 693 of 909
indicated. The program is also responsible for checking the error status. Refer to the following
section on error handling.
The value returned will be interpreted as a signed value. In other words, if the length is 1 or 2
and if reporting or assigning it to a longer data type such as variable x, then the data is sign-
extended.
Note that user interrupt events, ITR(…), can occur when waiting for an SDO operation to
complete. However, do not call an SDO operation from multiple interrupt levels concurrently.
For example, if an SDORD command is called in the main loop of a program, then do not call
an SDORD or SDOWR in an interrupt routine.
ERROR HANDLING:
Errors are handled as follows:
l
Errors during a read or write to CANopen objects through SDO may
not
specifically
cause a CAN error bit in status word 2. RCAN(4) command should always be inspected
to verify success of the SDORD, SDOWR, and NMT commands.
l
After each SDO read or write or NMT the specific code returned from the device will be
readable using command RCAN(4)
l
In the case of successful SDO read or write or NMT command, then the RCAN(4) shall
report 0 immediately after such command. The user should always inspect for value 0
to know that an operation was successful.
l
The user program is responsible for implementing any strategy for retry and/or giving
up after a certain number of tries. The firmware simply reports the status of each
attempt and will not automatically retry.
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
RELATED COMMANDS:
R
Part 2: Commands: SDORD(...)