SOEM EtherCAT example: How to read UDINT object

The following example builds on our previous post SOEM EtherCAT example: List all slaves.

It lists a single object, 0x2019, subindex 0x01, which is listed as UDINT in the user manual.

uint32_t udintValue;
int psize = sizeof(udintValue);
int result = ec_SDOread(slaveID, 0x2019, 0x01, FALSE, &psize, &udintValue, EC_TIMEOUTRXM);
if (result > 0) {
    printf("PDO 0x2019:01 UDINT: %u\n", udintValue);
} else {
    printf("Fehler beim Lesen von PDO 0x2019:01\n");
}

See SOEM EtherCAT example: How to read String object at specific subindex for a complete example on how this can be integrated into a full program.