EthercatDevice_XXX.sdoUpload8()

描述

(CoE) 讀取從站的 Object。(unit8_t)

格式

uint8_t sdoUpload8(uint16_t od_index, uint8_t od_subindex, uint32_t timeout_us = ECAT_DEFAULT_COE_TIMEOUT_US);

語法

EthercatDevice_XXX slave;
slave.sdoUpload8();

參數

  • uint16_t od_index:CANOpen 物件索引。
  • uint8_t od_subindex:CANOpen 物件子索引。
  • uint32_t timeout_us:超時,單位為一微秒。

回傳

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

範例

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_Generic slave;

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

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

    /* Write 0x08 to the object with index 0x6060. */
    slave.sdoDownload8(0x6060, 0x00, 0x08);
    /* Read value from the object with index 0x6061. */
    Serial.prinln(slave.sdoUpload8(0x6061, 0x00));

    master.start();
}

void loop() {}

函式庫參考主頁面

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

發表評論

上部へスクロール