EthercatDevice_XXX.sdoDownload8()

[EthercatDevice_XXX]

説明

(CoE) Write the object to the EtherCAT Slave device. (uint8_t)

Format

int sdoDownload8(uint16_t od_index, uint8_t od_subindex, uint8_t value, uint32_t timeout_us = ECAT_DEFAULT_COE_TIMEOUT_US);

Syntax

EthercatDevice_XXX slave;
slave.sdoDownload8();

Parameters

  • uint16_t od_index: CANOpen Object index.
  • uint8_t od_subindex: CANOpen Object sub-index.
  • uint8_t value: 1-byte Data.
  • uint32_t timeout_us: Timeout, unit for microsecond.

Returns

Int: 0 for successful; if the return value is smaller than 0 means error.

Example

#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() {}

Libraries Reference Home

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

コメントする

上部へスクロール