サイト内検索

検索

コードライブラリ

目次

motor.readTouchProbe1Value()

[EtherCAT Device CiA402]

説明

Read the touch probe position 1 positive/negative value object.

Relevant Objects

  • Object 60BAh: Touch probe position 1 positive value
  • Object 60BBh: Touch probe position 1 negative value

構文

int32_t readTouchProbe1Value(int value_selector);

媒介変数

  • [in] value_selector
    Choose the data source for reading the position value of touch probe 1:
定義コード説明
CIA402_TPVALUE_POS_EDGE0Read the touch probe position 1 positive value. (60BAh)
CIA402_TPVALUE_NEG_EDGE1Read the touch probe position 1 negative value. (60BBh)

戻り値

Return the touch probe position 1 value.

備考

この関数は、  . This function is non-blocking and can be called in callback functions if the related object is mapped to PDO.

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_CiA402 motor;

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

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

  motor.enableTouchProbe1(CIA402_TPMODE_FIRST_EVENT, CIA402_TPSRC_TP_INPUT, CIA402_TPTIMING_POS_EDGE);
  while (motor.isTouchProbe1ValueReady(CIA402_TPVALUE_POS_EDGE) == false);
  Serial.print("Touch probe position 1 positive value: ");
  Serial.println(motor.readTouchProbe1Value(CIA402_TPVALUE_POS_EDGE));
  motor.disableTouchProbe1();
}

void loop() {
  // put your main code here, to run repeatedly:

}

詳細は EtherCAT CiA 402 ユーザーマニュアル QEC EtherCAT命令とAPI使用法参照

上部へスクロール