跳转到内容

Trigger Software#

相机的 Trigger Software 功能允许您通过执行软件命令来触发相机。

该功能的使用#

通过执行软件命令来触发相机:

  1. TriggerSelector 参数设置为所需的 触发类型,例如 FrameStart
  2. TriggerMode 参数设置为 On
  3. TriggerSource 参数设置为 Software
  4. 执行 TriggerSoftware 命令。
    发送软件触发信号。该信号会触发选定的触发类型。

示例代码#

// Select the Frame Start trigger
camera.TriggerSelector.SetValue(TriggerSelector_FrameStart);
// Enable triggered image acquisition for the Frame Start trigger
camera.TriggerMode.SetValue(TriggerMode_On);
// Set the trigger source for the Frame Start trigger to Software
camera.TriggerSource.SetValue(TriggerSource_Software);
// Generate a software trigger signal
camera.TriggerSoftware.Execute();
INodeMap& nodemap = camera.GetNodeMap();
// Select the Frame Start trigger
CEnumerationPtr(nodemap.GetNode("TriggerSelector"))->FromString("FrameStart");
// Enable triggered image acquisition for the Frame Start trigger
CEnumerationPtr(nodemap.GetNode("TriggerMode"))->FromString("On");
// Set the trigger source for the Frame Start trigger to Software
CEnumerationPtr(nodemap.GetNode("TriggerSource"))->FromString("Software");
// Generate a software trigger signal
CCommandPtr(nodemap.GetNode("TriggerSoftware"))->Execute();
INodeMap& nodemap = camera.GetNodeMap();
// Select the Frame Start trigger
CEnumParameter(nodemap, "TriggerSelector").SetValue("FrameStart");
// Enable triggered image acquisition for the Frame Start trigger
CEnumParameter(nodemap, "TriggerMode").SetValue("On");
// Set the trigger source for the Frame Start trigger to Software
CEnumParameter(nodemap, "TriggerSource").SetValue("Software");
// Generate a software trigger signal
CCommandParameter(nodemap, "TriggerSoftware").Execute();
// Select the Frame Start trigger
camera.Parameters[PLCamera.TriggerSelector].SetValue(PLCamera.TriggerSelector.FrameStart);
// Enable triggered image acquisition for the Frame Start trigger
camera.Parameters[PLCamera.TriggerMode].SetValue(PLCamera.TriggerMode.On);
// Set the trigger source for the Frame Start trigger to Software
camera.Parameters[PLCamera.TriggerSource].SetValue(PLCamera.TriggerSource.Software);
// Generate a software trigger signal
camera.Parameters[PLCamera.TriggerSoftware].Execute();
// Select the Frame Start trigger
Pylon.DeviceFeatureFromString(hdev, "TriggerSelector", "FrameStart");
// Enable triggered image acquisition for the Frame Start trigger
Pylon.DeviceFeatureFromString(hdev, "TriggerMode", "On");
// Set the trigger source for the Frame Start trigger to Software
Pylon.DeviceFeatureFromString(hdev, "TriggerSource", "Software");
// Generate a software trigger signal
Pylon.DeviceExecuteCommandFeature(hdev, "TriggerSoftware");
/* 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 Frame Start trigger */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerSelector", "FrameStart");
CHECK(errRes);
/* Enable triggered image acquisition for the Frame Start trigger */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerMode", "On");
CHECK(errRes);
/* Set the trigger source for the Frame Start trigger to Software */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerSource", "Software");
CHECK(errRes);
/* Generate a software trigger signal */
errRes = PylonDeviceExecuteCommandFeature(hdev, "TriggerSoftware");
CHECK(errRes);

您也可以使用 pylon Viewer 轻松设置参数。