Periodic Signal (dart E)#
使用此功能#
運作原理#
支援 Periodic Signal 功能的 Basler dart E 相機提供額外的相機訊號來源, PeriodicSignal1。該訊號會與透過相機的輸入線 1 套用的電氣訊號進行同步。
例如,如果您對輸入線 1 套用週期為 0.3 秒的電氣訊號,相機的內部週期訊號就會調整,進而讓相機每 0.3 秒擷取一次影像。
當您增加或減少電氣訊號的週期時,相機的內部週期訊號需要一段時間才能適應新週期。相機的影格率會隨之增加或減少。當您停止套用電氣訊號時,影像擷取就會停止。
與標準硬體觸發相比,這具有以下優勢:
- 它允許邊緣觸發(上升緣或下降緣,透過
BslPeriodicSignalActivation參數進行設定)。標準硬體觸發僅允許位準觸發。 - 由於相機能夠「得知」該訊號具有週期性,因此它可以預測下一個訊號並為相機的影像擷取做好準備。這縮短了從偵測到觸發訊號到實際開始曝光之間的時間。
- 您可以指定負的 Trigger Delay(透過
BslPeriodicSignalDelay參數進行設定),這表示相機將在實際套用電氣訊號之前擷取影像。
資訊
Basler 建議以穩定的速率套用電氣訊號。在擷取過程中減少或增加週期可能會導致相機行為不穩定,並可能導致掉格。
設定 Periodic Signal#
若要將相機設定為同步影像擷取:
- 將相機設定為由週期訊號觸發:
- 將
TriggerMode參數設為On. - 將
TriggerSource參數設為PeriodicSignal1.
- 將
- 設定訊號轉換類型:
- 如果您希望相機在 下降 緣(輸入訊號)時擷取影像,請將
BslPeriodicSignalActivation參數設為FallingEdge. - 如果您希望相機在 上升 緣(輸入訊號)時擷取影像,請將
BslPeriodicSignalActivation參數設為RisingEdge.
- 如果您希望相機在 下降 緣(輸入訊號)時擷取影像,請將
- 設定 signal delay:
- 如果您希望相機在輸入訊號到達 立即 擷取影像,請將
BslPeriodicSignalDelay參數設為 0。 - 如果您希望相機在輸入訊號到達 之前或之後 輸入訊號到達時,請設定
BslPeriodicSignalDelayparameter 可設为任何其他奈秒值。例如,若將 parameter 設為 -500000,相機將會在預期收到下一個訊號的 0.5 秒前擷取影像。
- 如果您希望相機在輸入訊號到達 立即 擷取影像,請將
- 透過相機的 input line 1 套用週期性電氣訊號。
範例程式碼#
// Configure the camera to be triggered by the periodic signal
// Note: You must set the trigger source first and then the trigger mode
camera.TriggerSource.SetValue(TriggerSource_PeriodicSignal1);
camera.TriggerMode.SetValue(TriggerMode_On);
// Set the transition type to falling edge
camera.BslPeriodicSignalActivation.SetValue(BslPeriodicSignalActivation_FallingEdge);
// Set the signal delay to 0
camera.BslPeriodicSignalDelay.SetValue(0);
INodeMap& nodemap = camera.GetNodeMap();
// Configure the camera to be triggered by the periodic signal
// Note: You must set the trigger source first and then the trigger mode
CEnumParameter(nodemap, "TriggerSource").SetValue("PeriodicSignal1");
CEnumParameter(nodemap, "TriggerMode").SetValue("On");
// Set the transition type to falling edge
CEnumParameter(nodemap, "BslPeriodicSignalActivation").SetValue("FallingEdge");
// Set the signal delay to 0
CIntegerParameter(nodemap, "BslPeriodicSignalDelay").SetValue(0);
// Configure the camera to be triggered by the periodic signal
// Note: You must set the trigger source first and then the trigger mode
camera.Parameters[PLCamera.TriggerSource].SetValue(PLCamera.TriggerSource.PeriodicSignal1);
camera.Parameters[PLCamera.TriggerMode].SetValue(PLCamera.TriggerMode.On);
// Set the transition type to falling edge
camera.Parameters[PLCamera.BslPeriodicSignalActivation].SetValue(PLCamera.BslPeriodicSignalActivation.FallingEdge);
// Set the signal delay to 0
camera.Parameters[PLCamera.BslPeriodicSignalDelay].SetValue(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 */
/* Configure the camera to be triggered by the periodic signal */
/* Note: You must set the trigger source first and then the trigger mode */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerSource", "PeriodicSignal1");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "TriggerMode", "On");
CHECK(errRes);
/* Set the transition type to falling edge */
errRes = PylonDeviceFeatureFromString(hdev, "BslPeriodicSignalActivation", "FallingEdge");
CHECK(errRes);
/* Set the signal delay to 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslPeriodicSignalDelay", 0);
CHECK(errRes);
# Configure the camera to be triggered by the periodic signal
# Note: You must set the trigger source first and then the trigger mode
camera.TriggerSource.Value = "PeriodicSignal1"
camera.TriggerMode.Value = "On"
# Set the transition type to falling edge
camera.BslPeriodicSignalActivation.Value = "FallingEdge"
# Set the signal delay to 0
camera.BslPeriodicSignalDelay.Value = 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 */
/* Configure the camera to be triggered by the periodic signal */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerMode", "On");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "TriggerSource", "PeriodicSignal1");
CHECK(errRes);
/* Set the transition type to falling edge */
errRes = PylonDeviceFeatureFromString(hdev, "BslPeriodicSignalActivation", "FallingEdge");
CHECK(errRes);
/* Set the signal delay to 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslPeriodicSignalDelay", 0);
CHECK(errRes);
您也可以使用 pylon Viewer 輕鬆設定參數。