Error Codes#
如果發生了多項不同的錯誤,這些錯誤會被儲存於錯誤清單中,並可逐一檢視。
使用功能#
運作原理#
相機能夠偵測到某些錯誤。若發生此類錯誤,相機會為該錯誤指派一個錯誤代碼,並將該錯誤代碼儲存至記憶體中。
若發生多種不同的錯誤,攝影機會儲存每種已偵測到的錯誤代碼。無論攝影機偵測到該錯誤的次數有多少,每種代碼僅會儲存一次。
檢查Error Codes#
檢查錯誤代碼是一個反覆的過程,具體取決於您的相機型號以及發生了多少個錯誤。
ace 2、boost、dart M/R 以及 racer 2 攝影機#
Basler ace 2、boost、dart M/R 以及 racer 2 相機可產生一份錯誤清單,供 Basler 技術支援團隊進行評估。
要檢查 ace 2、boost、dart M/R 及 racer 2 攝影機的錯誤代碼:
- 取得
BslErrorPresent參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。 - 如果參數值是
true:- 取得
BslErrorReportValue參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。 - 請將該數值儲存於您的電腦中,或將其記錄下來以供日後參考。
- 執行
BslErrorReportNext指令。此指令會從裝置中擷取下一個錯誤代碼。 - 重複步驟 a) 至 c),直到
BslErrorReportValue參數值為0. 參數值為 0 表示已無更多錯誤代碼可擷取。 - 請將錯誤代碼清單提供給 Basler 技術支援部門。
- 取得
ace U/L 攝影機#
Basler ace U/L 相機可產生一份錯誤清單,這些錯誤可由您自行修正,或交由 Basler 技術支援團隊進行評估。
要檢查 ace U/L GigE 攝影機的錯誤代碼:
- 取得
LastError參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。 - 請將該數值儲存於您的電腦中,或將其記錄下來以供日後參考。
- 執行
ClearLastError指令。此指令會從錯誤代碼清單中刪除最後一個錯誤代碼。 - 重複步驟 1) 至 3),直到
LastError參數值為NoError. - 請參照下表排除錯誤,或將錯誤代碼清單提供給 Basler 技術支援團隊。
有貨Error Codes#
下表僅適用於 Basler ace U/L 系列相機。
| LastError 枚舉 | 含意 |
|---|---|
| NoError | 自上次清除錯誤記憶體以來,相機尚未偵測到任何錯誤。 |
| 過度觸發 | 發生了過早觸發。 當相機尚未準備好時,使用者便向相機發送了觸發訊號。 |
| 使用者集 | 嘗試載入使用者集時發生錯誤。通常這表示該使用者集包含一個無效的值。請嘗試載入其他使用者集。 |
| 參數無效 | 輸入的參數超出範圍或因其他原因而無效。通常,此錯誤僅在使用者透過直接存取寄存器來設定參數時才會發生。 |
| 過熱 | 此相機支援 Temperature State 功能,且溫度已超過過熱閾值。此錯誤表示相機元件可能已受損。 |
| 停電 | 此錯誤表示電源供應不足。 請檢查電源供應。 |
| 觸發寬度不足 | 此錯誤發生於「觸發寬度」曝光模式下,當觸發時間短於最低曝光時間時。 |
範例程式碼#
ace 2、boost、dart M 及 dart R 攝影機#
INodeMap& nodemap = camera.GetNodeMap();
// Check whether an error occurred on the device
bool errorPresent = CBooleanParameter(nodemap, "BslErrorPresent").GetValue();
// Get the first error code
int64_t errorReportValue = CIntegerParameter(nodemap, "BslErrorReportValue").GetValue();
// Retrieve the next error code from the device
CCommandParameter(nodemap, "BslErrorReportNext").Execute();
// Check whether an error occurred on the device
bool errorPresent = camera.Parameters[PLCamera.BslErrorPresent].GetValue();
// Get the first error code
Int64 errorReportValue = camera.Parameters[PLCamera.BslErrorReportValue].GetValue();
// Retrieve the next error code from the device
camera.Parameters[PLCamera.BslErrorReportNext].Execute();
/* 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 errorPresent = false;
int64_t errorReportValue = 0;
/* Check whether an error occurred on the device */
errRes = PylonDeviceGetBooleanFeature(hdev, "BslErrorPresent", &errorPresent);
CHECK(errRes);
/* Get the first error code */
errRes = PylonDeviceGetIntegerFeature(hdev, "BslErrorReportValue", &errorReportValue);
CHECK(errRes);
/* Retrieve the next error code from the device */
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslErrorReportNext");
CHECK(errRes);
ace U/L 攝影機#
size_t len = 0;
char lasterror_str[64] = {0};
/* Get the value of the last error code in the memory */
len = sizeof(lasterror_str);
errRes = PylonDeviceFeatureToString(hdev, "LastError", lasterror_str, &len);
CHECK(errRes);
/* Clear the value of the last error code in the memory */
errRes = PylonDeviceExecuteCommandFeature(hdev, "ClearLastError");
CHECK(errRes);
您也可以 use the pylon Viewer 來輕鬆設定參數。