Error Codes#
如果發生多種不同的錯誤,它們會儲存在錯誤清單中,並且可以逐一擷取。
使用此功能#
運作原理#
相機可以偵測特定錯誤。若發生此類錯誤,相機將會為該錯誤指派一個 error code,並將其儲存在 memory 中。
如果發生多種不同的錯誤,相機會儲存所偵測到的每種類型錯誤的代碼。無論偵測到相應錯誤多少次,相機每個代碼都只儲存一次。
檢查 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 相機上的 error codes:
- 取得
BslErrorPresent參數的值。 - 如果參數值為
true:- 取得
BslErrorReportValue參數的值。 - 將數值儲存在您的電腦上或記下來以便日後參考。
- 執行
BslErrorReportNext指令。這會從裝置擷取下一個 error code。 - 重複步驟 a) 至 c),直到
BslErrorReportValue參數值為0。參數值為 0 表示已無其他 error codes 可擷取。 - 請隨附 error codes 清單聯絡 Basler 支援團隊。
- 取得
ace U/L 相機#
Basler ace U/L 相機可以產生錯誤清單,供您自行修正或由 Basler 支援團隊進行評估。
若要檢查 ace U/L GigE 相機上的 error codes:
- 取得
LastError參數的值。 - 將數值儲存在您的電腦上或記下來以便日後參考。
- 執行
ClearLastError指令。這會從 error codes 清單中刪除最後一個 error code。 - 重複步驟 1) 至 3),直到
LastError參數值為NoError. - 使用 下表 進行錯誤排除,或將 error codes 清單提供給 Basler 支援團隊。
可用的 Error Codes#
下表僅適用於 Basler ace U/L 相機。
| LastError Enumerator | 含義 |
|---|---|
| NoError | 自上次清除 error memory 以來,相機未偵測到任何錯誤。 |
| Overtrigger | 發生 overtrigger。 當相機尚未準備好時,使用者向相機發送了觸發訊號。 |
| User Sets | 嘗試載入 User Sets 時發生錯誤。通常這表示 User Sets 包含無效值。請嘗試載入不同的 User Sets。 |
| InvalidParameter | 輸入了超出範圍或無效的 Property。通常此錯誤僅在使用直接暫存器存取設定 Property 時發生。 |
| OverTemperature | 相機支援 Temperature State 功能,且溫度已超過 over temperature threshold。此錯誤表示相機零件可能會受損。 |
| PowerFailure | 此錯誤表示電源供應不足。 請檢查電源供應。 |
| InsufficientTriggerWidth | 當觸發訊號小於最短 Exposure Time 時,系統會在 Trigger Width exposure mode 中回報此錯誤。 |
範例程式碼#
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);
您也可以使用 pylon Viewer 來輕鬆設定參數。