[Ethercat Device]
Description
Read the input process data of a certain size which starting from the specified offset for such EtherCAT slave device.
Syntax
int pdoRead(uint32_t offset, void *data, uint32_t size);
Parameters
[in] uint32_t offset
The offset value of input process data for such EtherCAT slave device.[out] void *data
The data buffer for reading input process data.[in] uint32_t size
The size of the data buffer for reading input process data.
Return Value
Return an error code. If the returned value is zero, it indicates a successful execution of this function.
Comment
This function must be called after a successful execution of EthercatMaster::start(). This function is non-blocking and can be called within the Cyclic Callback.
Example
#include "Ethercat.h"
EthercatMaster master;
EthercatDevice_Generic slave;
uint8_t buffer[4];
void setup() {
Serial.begin(115200);
master.begin();
slave.attach(0, master);
master.start(1000000);
}
void loop() {
slave.pdoRead(0, buffer, 4);
Serial.print("Buffer: ");
Serial.print(buffer[0]);
Serial.print(buffer[1]);
Serial.print(buffer[2]);
Serial.println(buffer[3]);
delay(1000);
}Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.