[Ethercat Device]
Description
Read the specified bit value from the input process data of such slave device.
Syntax
int pdoBitRead(uint32_t bit_offset);
Parameters
[in] uint32_t bit_offset
The bit offset value of input process data for such EtherCAT slave device.
Return Value
The specified bit value from the input process data of such slave device. If the returned value is less than zero, it indicates an error code.
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; void setup() { Serial.begin(115200); master.begin(); slave.attach(0, master); master.start(1000000); } void loop() { Serial.print("Bit-0 Value: "); Serial.println(slave.pdoBitRead(0)); Serial.print("Bit-7 Value: "); Serial.println(slave.pdoBitRead(7)); delay(1000); }
Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.