我想找...

搜尋

分享

目錄

EthercatDevice.pdoRead8()

[Ethercat Device]

描述

Read 8-bit input process data which starting from the specified offset for such EtherCAT slave device.

語法

uint8_t pdoRead8(uint32_t offset);

參數

  • [in] uint32_t offset
    The offset value of input process data for such EtherCAT slave device.

回傳值

Return the 8-bit input process data.

備註

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.

範例

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_Generic slave;

void setup(){
    Serial.begin(115200);
    master.begin();
    slave.attach(0, master);
    master.start();
}

void loop() {
    slave.pdoWrite8(0, 0xFF); /* Write value of byte offset 0 of slave's output process data. */
    Serial.println(slave.pdoRead8(0), HEX); /* Read value of byte offset 0 of slave's input process data. */
    delay(100);
}

Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.

返回頂端