[EtherCAT Device CiA402]
説明
Enable the touch probe 2.
Relevant Objects
- Object 60B8h: Touch probe function
- Object 60B9h: Touch probe status
- Object 60D0h: Touch probe source
構文
int enableTouchProbe2(int trigger_mode, int trigger_src, int trigger_timing);
媒介変数
[in] trigger_mode
Choose the trigger mode of touch probe 2:
| 定義 | コード | 説明 |
| CIA402_TPMODE_FIRST_EVENT | 0 | Trigger the first event. |
| CIA402_TPMODE_CONTINUOUS | 1 | Trigger events continuously. |
[in] trigger_src
Choose the trigger source of touch probe 2:
| 定義 | コード | 説明 |
| CIA402_TPSRC_TP_INPUT | 0x00010000 | Trigger with touch probe input. |
| CIA402_TPSRC_ENCODER_Z | 0x00020000 | Trigger with zero impulse signal or position encoder. |
| CIA402_TPSRC_DIGITAL_INPUT1 | 1 | Trigger with digital input 1. |
| CIA402_TPSRC_DIGITAL_INPUT2 | 2 | Trigger with digital input 2. |
| CIA402_TPSRC_DIGITAL_INPUT3 | 3 | Trigger with digital input 3. |
| CIA402_TPSRC_DIGITAL_INPUT4 | 4 | Trigger with digital input 4. |
| CIA402_TPSRC_HW_ENCODER_Z | 5 | Trigger with digital input 5. |
| CIA402_TPSRC_SW_ENCODER_Z | 6 | Trigger with digital input 6. |
[in] trigger_timing
Choose the trigger timing of touch probe 2:
| 定義 | コード | 説明 |
| CIA402_TPTIMING_NONE | 0 | Switch off all sampling of touch probe 2. |
| CIA402_TPTIMING_POS_EDGE | 1 | Enable sampling at positive edge of touch probe 2. |
| CIA402_TPTIMING_NEG_EDGE | 2 | Enable sampling at negative edge of touch probe 2 |
| CIA402_TPTIMING_BOTH | 3 | Enable sampling at both positive and negative edges of touch probe 2 simultaneously. |
戻り値
error codeを返します。返された値が 0の場合、この関数が正常に完了したことを示します。
備考
この関数は、 . This function is blocking and cannot be called in callback functions.
例
#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使用法参照