Input Filter#
此功能類似於 Line Debouncer 功能,該功能僅適用於 ace Classic/U/L 相機。
使用此功能#
運作原理#
您可以透過設定以下的一項或兩項相機設定來控制輸入濾波:
Input Filter Time#
數位輸入訊號到達相機時,通常無法完美成形。它們可能會受到周圍電磁場的雜訊與干擾(特別是在使用長 I/O 連接線時),或是附近電力設備的影響。此外,開關輸出也可能造成串音。
因此,從「低」變更為「高」(反之亦然)可能需要幾微秒的時間,且在轉換期間邏輯準位會處於未定義狀態。
指定 Input filter time 可讓您消除大部分此類問題。
輸入濾波會評估輸入訊號邏輯狀態的所有變更與持續時間。此評估期間的持續時間由 BslInputFilterTime 參數的值。
在評估期間,相機計算隨時間變化的平均值,並對結果套用閾值函數以重建數位訊號。這會移除雜訊、干擾等,以及小於濾波時間的訊號脈衝。
資訊
如果您指定了 Input filter time,且輸入訊號在原始轉換後仍不穩定,則傳播延遲會增加。
這表示類比 I/O 訊號變更與相機內部狀態變更之間的時間間隔將會拉長。
Input Hold-Off Time#
如果您想要避免因多個觸發訊號快速連續到達而導致的錯誤觸發(接點彈跳),設定 Input hold-off time 會非常有用。
如果設定了 Input hold-off time 且輸入觸發訊號到達,相機將會接受該訊號,並在 hold-off 時間經過之前停止接受任何進一步的觸發訊號或訊號變更。
例如,如果您將 BslInputHoldOffTime parameter 設為 10 並對相機套用觸發訊號,相機將會接受該訊號,並在 10 微秒內停止接受任何進一步的觸發訊號或訊號變更。
資訊
與 input filter time 不同,指定 Input hold-off time 不會增加傳播延遲。
設定 Input Filtering#
- 請確保相機已設定為 hardware triggering。
- 將
LineSelectorparameter 設為所需的輸入線,例如:Line1. - 如果您想要設定 input filter time,請輸入
BslInputFilterTime參數的值。 - 如果您想要設定 input hold-off time,請輸入
BslInputHoldOffTime參數的值。
選擇 Input Filter 與 Input Hold-Off Time#
- 選擇過低的 Input filter time 或 Input hold-off time 會導致接受無效的訊號與訊號狀態。
- 選擇過高的 Input filter time 或 Input hold-off time 會導致拒絕有效的訊號與訊號狀態。
Basler 建議採用下列方法:
- 請選擇一個稍長於預期無效信號的最長持續時間的 Input Filter 時間。
- 請選擇一個稍短於兩個有效信號之間預期最短間隔的輸入保持時間。
拒絕短有效信號的風險很小,但在大多數情況下,這種方法應該能提供良好的結果。請監控您的應用程式,如果發現被拒絕的有效信號過多,請在必要時調整數值。
範例程式碼#
INodeMap& nodemap = camera.GetNodeMap();
// Select the desired input line
CEnumParameter(nodemap, "LineSelector").SetValue("Line1");
// Set the input filter time to 10 microseconds
CFloatParameter(nodemap, "BslInputFilterTime").SetValue(10.0);
// Set the input hold-off time to 20 microseconds
CFloatParameter(nodemap, "BslInputHoldOffTime").SetValue(20.0);
// Select the desired input line
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line1);
// Set the input filter time to 10 microseconds
camera.Parameters[PLCamera.BslInputFilterTime].SetValue(10.0);
// Set the input hold-off time to 20 microseconds
camera.Parameters[PLCamera.BslInputHoldOffTime].SetValue(20.0);
/* 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 */
/* Select the desired input line */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line1");
CHECK(errRes);
/* Set the input filter time to 10 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "BslInputFilterTime", 10.0);
CHECK(errRes);
/* Set the input hold-off time to 20 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "BslInputHoldOffTime", 20.0);
CHECK(errRes);
您也可以使用 pylon Viewer 來輕鬆設定參數。