Exemplo SOEM EtherCAT: Como ler objeto UDINT
O seguinte exemplo baseia-se em nosso post anterior SOEM EtherCAT example: List all slaves.
Ele lista um único objeto, 0x2019, subíndice 0x01, que é listado como UDINT no manual do usuário.
soem_read_udint.c
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");
}Veja SOEM EtherCAT example: How to read String object at specific subindex para um exemplo completo de como isso pode ser integrado em um programa completo.
Check out similar posts by category:
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow