Line Logic#
I/O 線路的邏輯可以是正向或負向。
使用此功能#
決定 Line Logic#
若要決定 I/O 線路的邏輯:
- 將
LineSelector參數設定至所需的 I/O 線路。 - 取得
LineLogic參數的值。
此參數為唯讀。
Line Logic 概覽#
正向 Line Logic#
如果 line logic 為正向,I/O 線路的電氣狀態與 LineStatus 參數之間的關係如下:
| 電氣狀態 | LineStatus 參數值 |
|---|---|
| 高電壓位準 | True |
| 低電壓位準 | False |
負向 Line Logic#
如果 line logic 為負向,I/O 線路的電氣狀態與 LineStatus 參數之間的關係如下:
| 電氣狀態 | LineStatus 參數值 |
|---|---|
| 高電壓位準 | False |
| 低電壓位準 | True |
範例程式碼#
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK; /* Return value of pylon methods */
size_t len = 0;
char e_str[64] = {0};
/* Select a line */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line1");
CHECK(errRes);
/* Get the logic of the line */
len = sizeof(e_str);
errRes = PylonDeviceFeatureToString(hdev, "LineLogic", e_str, &len);
CHECK(errRes);
您也可以使用 pylon Viewer 來輕鬆設定參數。