跳至內容
測試伺服器
開發伺服器

Line Logic#

「Line Logic 」相機功能可讓您判定 I/O 線路的邏輯狀態。

I/O 線路的邏輯狀態可以是正邏輯,也可以是負邏輯。

使用功能#

確定Line Logic#

要判斷 I/O 線路的邏輯狀態:

  1. 將相機中的 LineSelector 將參數設定至所需的 I/O 線。
  2. 取得 LineLogic 參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。
    此參數為唯讀。

Line Logic 概覽#

正面的Line Logic#

若線路邏輯為正,則 I/O 線路的電氣狀態與 LineStatus 參數如下:

電氣狀態 LineStatus 參數值
電壓水準過高 是
電壓過低 錯誤

否Line Logic#

若線路邏輯為負值,則 I/O 線路的電氣狀態與 LineStatus 參數如下:

電氣狀態 LineStatus 參數值
電壓水準過高 錯誤
電壓過低 是

範例程式碼#

// Select a line
camera.LineSelector.SetValue(LineSelector_Line1);
// Get the logic of the line
LineLogicEnums e = camera.LineLogic.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Select a line
CEnumParameter(nodemap, "LineSelector").SetValue("Line1");
// Get the logic of the line
String_t e = CEnumParameter(nodemap, "LineLogic").GetValue();
// Select a line
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line1);
// Get the logic of the line
string e = camera.Parameters[PLCamera.LineLogic].GetValue();
/* 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);
# Select a line
camera.LineSelector.Value = "Line1"
# Get the logic of the line
e = camera.LineLogic.Value

您也可以 use the pylon Viewer 來輕鬆設定參數。