サイト内検索

検索

コードライブラリ

目次

motor.isTouchProbe2ValueReady()

[EtherCAT Device CiA402]

説明

Check if a positive or negative edge has occurred on the touch probe 2 signal source.

Relevant Objects

  • Object 60B9h: Touch probe status

構文

bool isTouchProbe2ValueReady(int value_selector);

媒介変数

  • [in] value_selector
    Choose the event to check on touch probe 2:
定義コード説明
CIA402_TPVALUE_POS_EDGE0Check if a positive edge has occurred on the touch probe 2 signal source.
CIA402_TPVALUE_NEG_EDGE1Check if a negative edge has occurred on the touch probe 2 signal source.

戻り値

Return whether a positive or negative edge has occurred on the touch probe 2 signal source.

備考

この関数は、  . 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.enableTouchProbe2(CIA402_TPMODE_FIRST_EVENT, CIA402_TPSRC_TP_INPUT, CIA402_TPTIMING_POS_EDGE);
  while (motor.isTouchProbe2ValueReady(CIA402_TPVALUE_POS_EDGE) == false);
  Serial.print("Touch probe position 2 positive value: ");
  Serial.println(motor.readTouchProbe2Value(CIA402_TPVALUE_POS_EDGE));
  motor.disableTouchProbe2();
}

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

}

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

上部へスクロール