SOEM EtherCAT 示例:如何读取 UDINT 对象
以下示例建立在我们之前的文章 SOEM EtherCAT 示例:列出所有从站之上。
它列出了单个对象 0x2019,子索引 0x01,在用户手册中列为 UDINT。
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");
}有关如何将其集成到完整程序中的完整示例,请参阅 SOEM EtherCAT 示例:如何在特定子索引读取 String 对象。
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