堡盟所有相機都支持硬件觸發——通過Line0(光耦隔離輸入輸出)和/或Line1和Line2(GPIO通用輸入輸出)進行觸發。如需了解相機的哪條線路可用于硬件觸發,請查看相機《用戶指南》的“過程接口”章節。堡盟相機的所有功能均根據EMVA標準功能命名約定(SFNC)第1.5.1版或更新版本命名。
堡盟相機提供符合行業標準的光耦隔離輸入,其中0…4.5V表示低電壓,11…30V表示高電壓。因此,觸發信號需介于11V和30V之間。在本例中,我們假設相機的Line0上有一條光耦隔離線路。
本例僅展示如何配置相機,并假定pDevice已與相機建立了有效的連接。按如下語言對相機進行設置,當Line0上的觸發信號為“高”時,相機將開始采集單個圖像,該圖像可通過常見的BGAPI::DataStream::GetFilledBuffer()函數調取。
// SETUP DIGITAL IO CONTROL
pDevice->GetRemoteNode("LineSelector")->SetString("Line0");
pDevice->GetRemoteNode("LineInverter")->SetBool(false); //high means high
// SETUP DEBOUNCER
// make sure only intended signals trigger the camera (ignore jitters on the line)
pDevice->GetRemoteNode("LineDebouncerHighTimeAbs")->SetDouble(1.0); // in μsec
pDevice->GetRemoteNode("LineDebouncerLowTimeAbs")->SetDouble(1.0); // in μsec
// SETUP ACQUISITION CONTROL
pDevice->GetRemoteNode("TriggerMode")->SetString("On");
pDevice->GetRemoteNode("TriggerSource")->SetString("Line0");
pDevice->GetRemoteNode("TriggerActivation")->SetString("RisingEdge");
pDevice->GetRemoteNode("TriggerDelay")->SetDouble(0.0); // delay in μsec
// SETUP DIGITAL IO CONTROL
mDevice.RemoteNodeList["LineSelector"].Value = "Line0";
mDevice.RemoteNodeList["LineInverter"].Value = false; // high means high
// SETUP DEBOUNCER
// make sure only intended signals trigger the camera (ignore jitters on the line)
mDevice.RemoteNodeList["LineDebouncerHighTimeAbs"].Value = (double)1.0; // in μsec
mDevice.RemoteNodeList["LineDebouncerLowTimeAbs"].Value = (double)1.0; // in μsec
// SETUP ACQUISITION CONTROL
mDevice.RemoteNodeList["TriggerMode"].Value = "On";
mDevice.RemoteNodeList["TriggerSource"].Value = "Line0";
mDevice.RemoteNodeList["TriggerActivation"].Value = "RisingEdge";
mDevice.RemoteNodeList["TriggerDelay"].Value = (double)0.0; // in μsec
大部分堡盟相機也采用GPIO線路,這些非零電勢通用輸入輸出需要2V或更高電壓的觸發信號(FPGA輸入:0…0.8V為低電平,2.0…30V為高電平)。
// SETUP DIGITAL IO CONTROL
pDevice->GetRemoteNode("LineSelector")->SetString("Line1"); // GPIO Line1
pDevice->GetRemoteNode("LineMode")->SetString("Input");
pDevice->GetRemoteNode("LineInverter")->SetBool(false);
// SETUP DEBOUNCER
// make sure only intended signals trigger the camera (ignore jitters on the line)
pDevice->GetRemoteNode("LineDebouncerHighTimeAbs")->SetDouble(1.0); // in μsec
pDevice->GetRemoteNode("LineDebouncerLowTimeAbs")->SetDouble(1.0); // in μsec
// SETUP ACQUISITION CONTROL
pDevice->GetRemoteNode("TriggerMode")->SetString("On");
pDevice->GetRemoteNode("TriggerSource")->SetString("Line1");
pDevice->GetRemoteNode("TriggerActivation")->SetString("RisingEdge");
pDevice->GetRemoteNode("TriggerDelay")->SetDouble(0.0); // delay in μsec
// SETUP DIGITAL IO CONTROL
mDevice.RemoteNodeList["LineSelector"].Value = "Line1"; // GPIO Line1
mDevice.RemoteNodeList["LineMode"].Value = "Input";
mDevice.RemoteNodeList["LineInverter"].Value = false;
// SETUP DEBOUNCER
// make sure only intended signals trigger the camera (ignore jitters on the line)
mDevice.RemoteNodeList["LineDebouncerHighTimeAbs"].Value = (double)1.0; // in μsec
mDevice.RemoteNodeList["LineDebouncerLowTimeAbs"].Value = (double)1.0; // in μsec
// ACQUISITION CONTROL
mDevice.RemoteNodeList["TriggerMode"].Value = "On";
mDevice.RemoteNodeList["TriggerSource"].Value = "Line1";
mDevice.RemoteNodeList["TriggerActivation"].Value = "RisingEdge";
mDevice.RemoteNodeList["TriggerDelay"].Value = (double)0.0; // in μsec
硬件觸發與堡盟GAPI配合使用