Line Overload Status#
使用功能#
線路過載的原因#
若將 GPIO 線路設定為輸出線路,您必須依照相機主題中的規定,施加適當的輸出訊號電壓。您可在「區域掃描與線掃描相機」章節中找到您的相機主題。
若未施加適當的電壓,可能會發生線路過載。只要未超過相機的絕對最大電壓,相機便能偵測到過載,並透過 BslLineOverloadStatus 參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。
判定 I/O 線路的過載狀態#
要判斷 GPIO 線路是否過載:
- 將相機中的
LineSelector參數設為所需的 I/O 線路,例如:Line1. - 取得
BslLineOverloadStatus參數。此參數為唯讀。
數值為 false (0) 表示該 GPIO 線路未被超載。
數值為 true (1) 表示 GPIO 線路已超載。請檢查您的 I/O 線路設定。
判定所有 I/O 線路的過載狀態#
若要透過單一操作來判定所有 I/O 線路的過載狀態,請讀取 BslLineOverloadStatusAll 參數。該參數以 64 位元值的形式呈現。
資訊
當 BslLineOverloadStatusAll 此參數僅可透過pylon API 取得,無法透過pylon Viewer 功能樹取得。
該值中的某些位元與 I/O 線路相關聯。每個位元皆表示其所對應線路的狀態:
- 若某個位元為 0,則對應的線路未被超載。
- 若某個位元為 1,表示對應的線路已過載。請檢查您的 I/O 線路設定。
位元與線的對應關係如下:
- 位元 0 表示 Line1 的狀態。
- 第 1 位元表示 Line2 的狀態。
- 第 2 位元表示第 3 條線路的狀態。
範例:所有線位高 = 0b111
資訊
若 buffer operator 的 Line Inverter 若此功能已啟用,相機將將 BslLineOverloadStatusAll 參數值。所有 0 位元均變為 1,反之亦然。
範例程式碼#
ace 2、boost 和 dart R 相機#
// Select a line
camera.LineSelector.SetValue(LineSelector_Line1);
// Determine the status of the selected line
bool status = camera.BslLineOverloadStatus.GetValue();
// Get the line overload status of all I/O lines
// Because the GenICam interface does not support
// 32-bit words, the line status is reported as a 64-bit value
int64_t lineOverloadStatusAll = camera.BslLineOverloadStatusAll.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Select a line
CEnumParameter(nodemap, "LineSelector").SetValue("Line1");
// Determine the status of the selected line
bool status = CBooleanParameter(nodemap, "BslLineOverloadStatus").GetValue();
// Get the line overload status of all I/O lines
// Because the GenICam interface does not support
// 32-bit words, the line status is reported as a 64-bit value
int64_t lineOverloadStatusAll = CIntegerParameter(nodemap, "BslLineOverloadStatusAll").GetValue();
// Select a line
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line1);
// Determine the status of the selected line
bool status = camera.Parameters[PLCamera.BslLineOverloadStatus].GetValue();
// Get the line overload status of all I/O lines
// Because the GenICam interface does not support
// 32-bit words, the line status is reported as a 64-bit value
Int64 lineOverloadStatusAll = camera.Parameters[PLCamera.BslLineOverloadStatusAll].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 */
_Bool status = false;
int64_t lineOverloadStatusAll = 0;
/* Select a line */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line1");
CHECK(errRes);
/* Determine the status of the selected line */
errRes = PylonDeviceGetBooleanFeature(hdev, "BslLineOverloadStatus", &status);
CHECK(errRes);
/* Get the line overload status of all I/O lines */
/* Because the GenICam interface does not support */
/* 32-bit words, the line status is reported as a 64-bit value */
errRes = PylonDeviceGetIntegerFeature(hdev, "BslLineOverloadStatusAll", &lineOverloadStatusAll);
CHECK(errRes);
# Select a line
camera.LineSelector.Value = "Line1"
# Determine the status of the selected line
status = camera.BslLineOverloadStatus.Value
# Get the line overload status of all I/O lines
# Because the GenICam interface does not support
# 32-bit words, the line status is reported as a 64-bit value
lineOverloadStatusAll = camera.BslLineOverloadStatusAll.Value
其他相機#
// Select a line
camera.LineSelector.SetValue(LineSelector_Line1);
// Determine the status of the selected line
bool status = camera.LineOverloadStatus.GetValue();
// Get the line overload status of all I/O lines
// Because the GenICam interface does not support
// 32-bit words, the line status is reported as a 64-bit value
int64_t lineOverloadStatusAll = camera.LineOverloadStatusAll.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Select a line
CEnumParameter(nodemap, "LineSelector").SetValue("Line1");
// Determine the status of the selected line
bool status = CBooleanParameter(nodemap, "LineOverloadStatus").GetValue();
// Get the line overload status of all I/O lines
// Because the GenICam interface does not support
// 32-bit words, the line status is reported as a 64-bit value
int64_t lineOverloadStatusAll = CIntegerParameter(nodemap, "LineOverloadStatusAll").GetValue();
// Select a line
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line1);
// Determine the status of the selected line
bool status = camera.Parameters[PLCamera.LineOverloadStatus].GetValue();
// Get the line overload status of all I/O lines
// Because the GenICam interface does not support
// 32-bit words, the line status is reported as a 64-bit value
Int64 lineOverloadStatusAll = camera.Parameters[PLCamera.LineOverloadStatusAll].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 */
_Bool status = false;
int64_t lineOverloadStatusAll = 0;
/* Select a line */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line1");
CHECK(errRes);
/* Determine the status of the selected line */
errRes = PylonDeviceGetBooleanFeature(hdev, "LineOverloadStatus", &status);
CHECK(errRes);
/* Get the line overload status of all I/O lines */
/* Because the GenICam interface does not support */
/* 32-bit words, the line status is reported as a 64-bit value */
errRes = PylonDeviceGetIntegerFeature(hdev, "LineOverloadStatusAll", &lineOverloadStatusAll);
CHECK(errRes);
# Select a line
camera.LineSelector.Value = "Line1"
# Determine the status of the selected line
status = camera.LineOverloadStatus.Value
# Get the line overload status of all I/O lines
# Because the GenICam interface does not support
# 32-bit words, the line status is reported as a 64-bit value
lineOverloadStatusAll = camera.LineOverloadStatusAll.Value
您也可以 use the pylon Viewer 來輕鬆設定參數。