EthercatDevice_XXX.pdoRead8()

[EthercatDevice_XXX]

描述

讀取從站的 Input PDO。(unit8_t)

格式

uint8_t pdoRead8(uint16_t offset);

語法

EthercatDevice_XXX slave;
slave.pdoRead8();

參數

  • uint16_t offset:PDO 的內存地址。

回傳

uint8_t:1-byte 的數據。如果出錯,返回值為0。

範例

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_Generic slave;

void setup()
{
    Serial.begin(115200);

    master.begin();
    slave.attach(0, master);
    master.start();
}

void loop()
{
    /* Write value of byte offset 0 of slave's output process data. */
    slave.pdoWrite8(0, 0xFF);

    /* Read value of byte offset 0 of slave's input process data. */
    Serial.println(slave.pdoRead8(0), HEX);

    delay(100);
}

函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール