LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clarification on PDO Object Specification in NI IndCom for CANopen

Solved!
Go to solution

Hi people,

I recently started using NI IndCom for CANopen and have a basic query. According to the protocol, RPDO Communication Parameters include COB-ID and Transmission Type, while RPDO Mapping Parameters define the linked objects.

When using the LabVIEW API, we create PDO objects with inputs as PDO1/PDO2/PDO3/PDO4, optionally specifying the COB-ID, and then write data using the RPDO Write function. My question is: while creating RPDO and writing data, how do we specify which object within PDO1/PDO2/PDO3/PDO4 we are referring to? Since multiple objects are linked to a single PDO, but we provide only one data input while writing, I am facing difficulties in PDO communication.

Your guidance on this would be highly valuable.
Thanks in advance for your help!

0 Kudos
Message 1 of 5
(219 Views)

Hi SD,

 


SD@01 wrote:

My question is: while creating RPDO and writing data, how do we specify which object within PDO1/PDO2/PDO3/PDO4 we are referring to? Since multiple objects are linked to a single PDO, but we provide only one data input while writing, I am facing difficulties in PDO communication


The content of the PDO objects is defined by settings in your device.

You can change those settings (typically) using SDOs.

 

Read the manual of your device to learn about the default content of all PDOs and how to configure them…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(203 Views)

Hii GerdW

Thanks for your response!!

To just give you the context, I am using EPOS4 Compact CAN Digital positioning controller as CANopen node in my CAN network. I am controlling this device using NI 9881 CANopen interface module installed in cRIO-9049 chassis. Also I am using NI Industrial Communications for CANopen driver for programming my application in LabVIEW. 

We can map objects to RPDO as defined in Firmware specifications of EPOS4 device (Please find attached Image 1 for the reference). 

In LabVIEW, I am using Batch SDO service provided by NI Industrial Communications for CANopen driver to write multiple SDO's at a time and I am defining my mapping here (Please find attached Image 2 for the reference). 

Now when I program my application, I need to first create PDO and then use its reference to write data to that PDO. I have attached a simple example of RPDO Write (Please find attached Image 3 for the reference) where we use RPDO Create VI and provide a channel name at its input. The channel name is an enum having 4 items namely PDO1,PDO2,PDO3 and PDO4 (corresponding to 4 possible process data objects). 
After this, we start PDO and use CANopen RPDO Write VI to write data to the PDO. 

In this particular scenario, when I create PDO1 and write data to the PDO1, which object from this PDO1 (as defined in PDO mapping) am I referring to while writing the data as multiple objects are mapped to the PDO1 itself ?


Your inputs will be highly appreciated.

Thank you in advance!!

 

Image 1Image 1Image 2Image 2Image 3Image 3

0 Kudos
Message 3 of 5
(189 Views)

Hi SD,

 


SD@01 wrote:

In this particular scenario, when I create PDO1 and write data to the PDO1, which object from this PDO1 (as defined in PDO mapping) am I referring to while writing the data as multiple objects are mapped to the PDO1 itself ?


The PDO can contain several values and you write an array of values. Each array element corresponds to an element/value in the PDO.

I guess XNET maps the array elements to the PDO entries in corresponding order, but I never worked with XNET…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(185 Views)
Solution
Accepted by topic author SD@01

Hey GerdW,

Thank you for your timely help—you were spot on!

When using the NI Industrial Communications for CANopen driver in LabVIEW, writing data to an RPDO and reading from a TPDO involves mapping each array element to a corresponding PDO object. To illustrate this, consider the following example:

Example: PDO1 Mapping

PDO1 consists of three mapped objects:

  • Object 1 – Controlword (Data type: U16)
  • Object 2 – Mode of Operation (Data type: U8)
  • Object 3 – Target Velocity (Data type: U32)

When writing data using the RPDO Write VI, the input is an array of U8 elements. Each element in the array corresponds to a mapped object in the same sequence as the PDO mapping. Since the array uses U8 data types, multiple U8 elements combine to represent values for objects with U16 and U32 data types.

Byte Mapping in the Array

Following the PDO mapping above, the array elements correspond to object values as follows:

  • Array element 1 = Lower 8 bits of Controlword (0–7 bits)
  • Array element 2 = Upper 8 bits of Controlword (8–15 bits)
  • Array element 3 = Mode of Operation (0–7 bits)
  • Array element 4 = Lowest 8 bits of Target Velocity (0–7 bits)
  • Array element 5 = Next lower 8 bits of Target Velocity (8–15 bits)
  • Array element 6 = Next lower 8 bits of Target Velocity (16–23 bits)
  • Array element 7 = Upper 8 bits of Target Velocity (24–31 bits)

By writing data in this sequence, values are assigned to all mapped objects within the PDO. Similarly, when reading data from a TPDO, the same mapping structure applies.

I’ve done my best to explain this concept with a practical example, and I hope this helps the community.

Thanks again for your support!

0 Kudos
Message 5 of 5
(129 Views)