Access to the CANopen SDOs
(Original Document)
At a Glance
The READ_VAR and WRITE_VAR communication functions are used to access the transfer of SDO-type CAN open data. The parameters of these functions determine the action that is performed.
These services are based on CANopen standard CMS standardized message handling. See the documentation for the CANopen slaves for information about the SDO formats used.
CAUTION
UNEXPECTED APPLICATION BEHAVIOR
Do not send or receive SDOs simultaneously.
Failure to follow these instructions can result in injury or equipment damage.
If SDOs are send and receive simultaneously, the following SDO may not be processed. If this happens, perform a cold restart using the processor RESET button to reset the application and return to the normal operating mode.
Representation
FBD Representation:
LD Representation:
ST Representation:
The communication function syntax is as follows:
WRITE_VAR(ADDR('0.m.1.SYS'), 'SDO', index:subindex, NodeID, %MWi:L, %MWk:4)
READ_VAR(ADDR('0.m.1.SYS'), 'SDO', index:subindex, NodeID, %MWk:4, %MWi:L)
Parameter Description of the WRITE_VAR Function
The communication function syntax is as follows:
The following table describes the various parameters of the function.
Parameter
Description
ADDR('0.m.1.SYS')
Address of the exchange destination entity:
  • m: processor slot in the rack (0 or 1)
  • 1: channel (always 1)
  • SYS: UNI-TE server of the PCMCIA card
'SDO'
SDO object type (always SDO in capitals)
subindex:index
Double word or immediate value identifying the CANopen SDO index or subindex:
The most significant word making up the double word contains the sub-index and the least significant word contains the index.
Example: if you use the double word %MD0:
  • %MW0: contains the index,
  • %MW1: contains the sub-index.
NodeID
Word or value identifying the destination device on the CANopen bus
%MWi:L
Table of words containing the data to be sent (minimum length = 1)
%MWk:4
Exchange management parameters: four words identifying the address of the data used to control the function called WRITE_VAR
Parameter Description of the READ_VAR Function
The communication function syntax is as follows:
The following table describes the various parameters of the function.
Parameter
Description
ADDR('0.m.1.SYS')
Address of the exchange destination entity:
  • m: processor slot in the rack (0 or 1)
  • 1: channel (always 1)
  • SYS: UNI-TE server of the PCMCIA card
'SDO'
SDO object type (always SDO in capitals)
subindex:index
Double word or immediate value identifying the CANopen SDO index or subindex:
The most significant word making up the double word contains the sub-index and the least significant word contains the index.
Example: if you use the double word %MD0:
  • %MW0: contains the index,
  • %MW1: contains the sub-index.
NodeID
Word or value identifying the destination device on the CANopen bus
%MWk:4
Exchange management parameters: four words identifying the address of the data used to control the function called READ_VAR
%MWi:L
Table of words containing the data to be received (minimum length = 1)
Management Parameters
The management parameters are grouped together in the form of an array of 4 integers. The values contained the this array can be used to manage communication functions. They are detected by the processor that ran the function.
The following table gives details of the %MWk words.
Word number
Most significant byte
Least significant byte
Data managed by
%MWk
Exchange number
Activity bit
The system
%MWk+1
Operation report
Communication report
%MWk+2
Timeout
You
%MWk+3
Byte length:
  • for a WRITE_VAR, initialize this word with the number of bytes to be sent, at each time, before sending the write_var.
  • for a READ_VAR, when the request is terminated, this word contains the number of characters received in the word table of received data.
NOTE: A function can detect a parameter error before activating the exchange. The activity bit remains at 0 and the communication report is initialized with the values corresponding to the detected error.
The following table explains the meaning of the values of the %MWk+1 word:
Word number
Operation report
Communication report
%MWk+1
These codes are for CANopen services on a remote application.
16#00: Positive result
16#01: Request not processed
16#02: Incorrect response
16#03: Reserved
These codes are for FBs READ_VAR, WRITE_VAR & SEND_REQ on a remote application.
This report is only significant when activity bit goes from 1 to 0.
16#00: Correct message exchange
16#00
16#01: Exchange stopped due to timeout
16#02: Exchange stopped due to user demand (CANCEL)
16#03: Incorrect address format
16#04: Incorrect destination format
16#05: Incorrect management parameter format
16#06: Incorrect specific parameter
16#07: Problem sending to destination
16#08: Reserved
16#09: Insufficient receive buffer size
16#0A: Insufficient send buffer size
16#0B: No system resources: the number of simultaneous communication EFs exceeds the maximum that can be managed by the processor
16#0C: Incorrect exchange number
16#0D: No telegram received
16#0E: Incorrect length
16#0F: Telegram service not configured
16#10: Network module missing
16#11: Request missing
16#12: Application server already active
16#13: UNI-TE transaction number incorrect
%MWk+1
16#01: No resources toward the processor
16#02: No line resources
15#03: No device or a device without resourcesNote: This code is only managed by PCMCIA cards TSX FPP 10 and TSX FPP 20.
16#04: Detected line error
16#05: Detected length error
16#06: Inoperative communication channel
16#07: Detected addressing error
16#08: Detected application error
16#0B: No system resources: the number of simultaneous communication EFs exceeds the maximum that can be managed by the processor
16#0C: Communication function not active
16#0D: Destination missing
16#0F: Inter-station routing problem or channel not configured
16#11: Incorrect address format
16#12: No destination resource
16#14: Inoperative connection (for example: Ethernet TCP/IP)
16#15: No resource on local channel
16#16: Access not authorized (for example: Ethernet TCP/IP)
16#17: Inconsistent network configuration (for example: Ethernet TCP/IP)
16#18: Connection temporally unavailable
16#21: Application server stopped
16#30: Detected transmission error
16#FF: Message refused