At this guide we will see how to create SDOs to give commands to the controller and query its parameters. The SDOs (Service Data Objects) are messages that can be sent irregularly during the operation of the controller and they can be used for non recurrent tasks. For example an SDO can be used to update the controller's output state only when a button is pressed. A different approach would be to send the button state continuously over time in a cycled way. For the second option, refer to the PDOs (process Data Objects) operation.

Creating an SDO

On this guide we will use PCAN to illustrate the SDOs frame, but the same frame structure exists in general. You can fill each byte of the frame by using the following setps: 

1. Message ID

Fill the ID of the message by putting 600 + the ID of the node of the controller. 

If the Node ID is 1, then the message ID will be 601

If the Node ID is 10, then the message ID will be 60A, since the message ID is expressed in HEX format.

2. Frame Length

This concerns only the data bytes and can be set always as 8 for the SDOs

3. Byte 0

Here, to simplify things, there is a standard table that we will use.

According to that table, if we want to write a 4 bytes object (for example Motor command - Signed 32 bits) we will use 23. If we want to write a 1 byte object (for example set individual output bits - Unsigned 8) we will use 2F. For all the read requests (e.g. read motor amps, motor power, motor command etc) we can use 40.

To object length can be found in the object dictionary of the CAN Open Networking manual.


4. Bytes 1 and 2

Here we will set the ID of the object we want to access. The ID of each object can be found in the object dictionary of the CAN Open Networking manual. The more singificant byte of the object ID will be set to the byte 2 of the frame and the less significant to the byte 1.

For example the IDs of the following two objexts will be set as follows: 

index is 2006

Index is 2007

5. Byte 3

Here is the subindex of the object. Set 1 if you want to access channel 1 (e.g. set motor command of channel 1) and 2 if you want to access channel 2. In case of objects with more subindex values (e.g. user var) use the subindex of the object that you want to access. For example to write user var 14, use sub index 14.

In the following window, the acceleration of channel 1 wil be set

6. Bytes 4 to 7

If it is a read request, these bytes will be left 0. If it is a write request, the desired value will ba added there. Byte number 7 is the most significant byte of the data.

So for example, if you want to se the 1500 RPM/s as acceleration on channel two you will create the following frame:

Command response

The controller will give a reply coresponding to the message request. If it is a write request, it will give a reply that will state if the write was succesful or not and if it is a read request - and if the read was successful - it will return the queried value in the data bytes.