[EthercatDevice_DmpStepper_Generic]
説明
EtherCATスレーブデバイス上の指定されたエンコーダの現在の方向を取得します。
派生クラス:
クラス名 | 製造者ID | 製品コード |
EthercatDevice_QECR11MP3S | 0x00000bc3 | 0x0086d0d6 |
EthercatDevice_QECR00MP3S | 0x00000bc3 | 0x0086d0d9 |
構文
int encoderDirectionRead(int encoder);
媒介変数
[in] int encoder
指定されたエンコーダ番号:
定義 | Value | 説明 |
ECAT_ENCODER_1 | 0x01 | EtherCATスレーブデバイス上のエンコーダ1 |
ECAT_ENCODER_2 | 0x02 | EtherCATスレーブデバイス上のエンコーダ2 |
ECAT_ENCODER_3 | 0x03 | EtherCATスレーブデバイス上のエンコーダ3 |
ECAT_ENCODER_X | 0x11 | エンコーダXで、マッピングは configMachineAxisMapping() によって決定されます。 |
ECAT_ENCODER_Y | 0x12 | エンコーダYで、マッピングはconfigMachineAxisMapping() によって決定されます。 |
ECAT_ENCODER_Z | 0x13 | エンコーダZで、マッピングはconfigMachineAxisMapping() によって決定されます。 |
戻り値
Return the current direction of the specified encoder. A return value of 0 indicates forward rotation, while a return value of 1 indicates reverse rotation. If the returned value is less than zero, it indicates an error codeを示します。.
備考
この関数は、 EthercatMaster::start()
が正常に実行された後で、 EthercatMaster::stop()
が正常に実行された後に呼び出す必要があります。 この関数はブロッキングされており、コールバック関数内で呼び出すことはできません。
例
#include "Ethercat.h" EthercatMaster master; EthercatDevice_QECR11MP3S slave; void setup() { Serial.begin(115200); master.begin(); slave.attach(0, master); master.start(); } void loop() { Serial.print("Encoder 1 Direction: "); Serial.println(slave.encoderDirectionRead(ECAT_ENCODER_1)); Serial.print("Encoder 2 Direction: "); Serial.println(slave.encoderDirectionRead(ECAT_ENCODER_2)); Serial.print("Encoder 3 Direction: "); Serial.println(slave.encoderDirectionRead(ECAT_ENCODER_3)); Serial.print("Encoder X Direction: "); Serial.println(slave.encoderDirectionRead(ECAT_ENCODER_X)); Serial.print("Encoder Y Direction: "); Serial.println(slave.encoderDirectionRead(ECAT_ENCODER_Y)); Serial.print("Encoder Z Direction: "); Serial.println(slave.encoderDirectionRead(ECAT_ENCODER_Z)); delay(1000); // ... }
Please see EthercatDevice_DmpStepper_Generic Class for more QEC Stepper Drivers instructions and API usage.