
Software Tools
Examples of SDO Requests
Programmed
SDO Request:
Example 1
This example gives the program for reading object 1000H. After a request is made, the data obtained is read in the table Diag0:120 (defined below).
Variables used and parameters of the function
Variable | Type | Description |
|
|
|
Read_sdo | Boolean | Request launch bit. |
|
|
|
Index | Word | Index of the object to poll (LSB of the double word |
|
| "Index_dw"). |
|
|
|
Word | ||
|
| word "Index_dw"). |
|
|
|
Slave_add | Word | Address of the slave to poll. |
|
|
|
Diag0:120 | Word table | Data exchange area. |
|
|
|
Status0:4 | Word table | Control and exchange status words. |
|
|
|
ADR#y.SYS | Immediate value | Master board address. |
|
|
|
‘SDO’ | Character string | Type of SDO object (SDO always in upper case). |
|
|
|
Index_dw | Double word | MSB = |
|
| LSB = index. |
|
|
|
Node_Id | Word | Word or value identifying the destination device |
|
| on the CANopen bus. |
|
|
|
Program
Slave_add:=2 (*node at address 2 on the CANopen network*) Index:=16#1000; (*index 1000H*)
Sub_index:=0;
IF Read_sdo THEN
(*clear control*)
Read_sdo:=FALSE;
(*Parameter update*)
Node_Id:=Slave_add; (*Slave address*) Diag0:120:=16#FFFF; (*Clear diagnostics receive table*) Status2:=0; (*Clear exchange report*)
Status3:=6;
120 | 1606218 02 08/2006 |