跳转到内容

Timer#

相机的 Timer 功能允许您配置在遇到特定相机事件时变为高电平、在特定持续时间后变为低电平的计时器输出信号。

该功能的使用#

ace 2、boost 和 dart IMX 相机#

信息

本部分介绍 Counter 功能在 ace 2、boost 和 dart IMX 相机上的表现。对于 ace classic/U/L 相机,请单击此处

运作原理#

有两个计时器可用:计时器 1 和计时器 2。

计时器的工作方式如下:

  • 发生启动内部计时器的触发源事件
  • 延迟开始到期。
  • arm 延迟开始到期。
  • 延迟到期后,计时器输出信号将变为高电平并在您配置的持续时间内保持高电平。
  • 持续时间到期时,定时器输出信号变为低电平。
  • arm 延迟到期后,相机可以接收下一个触发源事件。

计时器操作

配置计时器#

要配置计时器:

  1. TimerSelector 参数设置为所需的计时器,例如 Timer1
  2. TimerDuration 参数设置为所需的计时器持续时间(以微秒为单位)。
  3. TimerDelay 参数设置为所需的计时器延迟(以微秒为单位)。
  4. TimerTriggerArmDelay 参数设置为所需的 arm 延迟(以微秒为单位)。
  5. LineSelector 参数设置为要用于计时器信号的输出线路。
    如果该线路是 GPIO 线路,则必须将该线路配置为输出
  6. 如果在步骤 1 中选择了计时器 1,请将 LineSource 参数设置为 Timer1Active
  7. 如果在步骤 1 中选择了计时器 2,请将 LineSource 参数设置为 Timer2Active

启动计时器#

计时器触发源

TimerTriggerSource 参数允许您指定由哪个源启动计时器。

要指定触发源:

  1. TimerSelector 参数设置为所需的计时器,例如 Timer1
  2. TimerTriggerSource 参数设置为要用于启动计时器的源。

现在,只要相机在所选信号源上检测到信号,计时器就会启动。

在启动时,计时器的状态立即从 TimerTriggerWait 变为 TimerActive,无论延迟如何设置都是如此。但是,计时器输出信号仅在延迟结束后才变为高电平。

示例 1:TimerTriggerSource 参数设置为 Line2。现在,当线路 2 的输入或输出信号改变时,计时器就会启动。

示例 2:TimerTriggerSource 参数设置为 SoftwareSignal1。现在,只要您通过通道 1 执行 SoftwareSignalPulse 命令,计时器就会启动。

计时器触发激活

默认情况下,仅当选定触发源上的信号上升时,即信号状态从低变高时,计时器才会启动。

若要改变此行为,请将 TimerTriggerActivation 参数设置为以下值:

  • RisingEdge(默认值):当信号上升时,即信号状态从低变高时,计时器启动。
  • FallingEdge:当信号下降时,即信号状态从高变低时,计时器启动。
  • AnyEdge:当信号下降或上升时,计时器启动。
  • LevelHigh:当信号为高电平时,计时器启动。当信号变为低电平时,计时器停止,必须重新启动
  • LevelLow:当信号为低电平时,计时器启动。当信号变为高电平时,计时器停止,必须重新启动

信息

TimerTriggerActivation 参数仅适用于计时器触发源,该触发源可以为高 (0) 或低 (1),即 I/O 信号或 ExposureActive 之类的“激活”信号。

重置计时器#

要重置计时器,请执行 TimerReset 命令。

计时器的状态TimerActive 更改为 TimerTriggerWait

现在,无论 arm 延迟设置如何,都可以立即重启计时器。

获取计时器状态#

要获取计时器的当前状态,请获取 TimerStatus 参数的值。此为只读参数。

可能的值包括:

  • TimerTriggerWait:计时器正在等待启动
  • TimerActive:计时器已启动。发生触发源事件时,无论延迟如何设置,计时器都会立即切换到此状态。如果设置了 arm 延迟,则计时器将保持在 TimerActive状态,直到 arm 延迟到期为止。
  • TimerIdle:计时器处于空闲状态。每当将 TimerTriggerSource 参数设置为 Off 时,计时器就处于此状态,即无法启动计时器。

ace classic/U/L 相机#

信息

本部分介绍 Counter 功能在 ace classic/U/L 相机上的表现。对于 ace 2、boost 和 dart IMX 相机,请单击此处

运作原理#

一个计时器可用,即 Timer 1。这是计时器的工作方式:

  • 发生启动内部计时器的触发源事件(如 Exposure Start)。
  • 延迟开始到期。
  • 延迟到期后,计时器输出信号将变为高电平并在您配置的持续时间内保持高电平。
  • 信号持续时间到期时,定时器输出信号变为低电平。

计时器操作

配置 Timer#

  1. LineSelector 参数设置为要用于计时器信号的输出线路。
    如果该线路是 GPIO 线路,则必须将该线路配置为输出
  2. LineSource 参数设置为 TimerActive
  3. TimerTriggerSource 参数设置为可用的触发源事件之一:

    • ExposureStart:计时器在曝光开始时启动。
    • FlashWindowStart:打开闪烁窗口时,计时器开始计时。
  4. TimerDuration 参数设置为所需的计时器持续时间(以微秒为单位)。

  5. TimerDelay 参数设置为所需的计时器延迟(以微秒为单位)。

信息

在部分相机机型上,您可能必须延长计时器最长持续时间并增大计时器延迟值。

增加最大计时器持续时间和延迟#

部分相机机型上TimerDurationTimerDelay 参数限制为默认最大值 4 095

要延长这些型号的计时器最长持续时间

  1. 将所需的计时器持续时间除以 4095,然后将结果四舍五入为最接近的整数。
    示例:假设您要将计时器持续时间设置为 50 000 µs。50000 / 4095 = 12.21 ≈ 13。
  2. TimerDurationTimebaseAbs 参数设置为在步骤 1 中确定的值,本例中为 13。
  3. TimerDuration 参数设置为所需的计时器持续时间,本例中为 50 000。
    相机在内部按以下方式计算计时器持续时间:TimerDurationRaw x TimerDurationTimebaseAbs = TimerDurationAbs

要增加这些型号的计时器最大延迟值:

  1. 将所需的计时器延迟除以 4095,并将结果四舍五入为最接近的整数。
    示例:假设您要将计时器延迟设置为 6 000 µs。6000 / 4095 = 1.47 ≈ 2。
  2. TimerDelayTimebaseAbs 参数设置为在步骤 1 中确定的值,本例中为 2。
  3. TimerDelay 参数设置为所需的计时器延迟,本例中为 6000。
    相机在内部按以下方式计算计时器延迟:TimerDelayRaw x TimerDelayTimebaseAbs = TimerDelayAbs

信息

根据 TimerDurationTimebaseAbsTimerDelayTimebaseAbs 参数值,相机可能无法达到所需的确切计时器持续时间和延迟。
例如,如果将 TimerDurationTimebaseAbs 参数设置为 13,则相机使用的计时器持续时间只能是 13 的倍数。因此,如果将 TimerDuration 参数设置为 50 000,而将 TimerDurationTimebaseAbs 参数设置为 13,则相机将自动更改设置为最接近的可能值(例如 49 998,它是最接近的 13 的倍数)。

附加参数#

  • TimerSelector:设置要配置的计时器。因为 Basler ace classic/U/L 相机仅支持一个计时器,此参数是预设的,无法更改。

详情#

显示所有相机型号

相机型号 计时器持续时间和延迟的默认最大值
a2A1920-51gcBAS 16 777 215
a2A1920-51gcPRO 16 777 215
a2A1920-51gmBAS 16 777 215
a2A1920-51gmPRO 16 777 215
a2A1920-160ucBAS 16 777 215
a2A1920-160ucPRO 16 777 215
a2A1920-160umBAS 16 777 215
a2A1920-160umPRO 16 777 215
a2A2590-22gcBAS 16 777 215
a2A2590-22gcPRO 16 777 215
a2A2590-22gmBAS 16 777 215
a2A2590-22gmPRO 16 777 215
a2A2590-60ucBAS 16 777 215
a2A2590-60ucPRO 16 777 215
a2A2590-60umBAS 16 777 215
a2A2590-60umPRO 16 777 215
a2A3840-13gcBAS 16 777 215
a2A3840-13gcPRO 16 777 215
a2A3840-13gmBAS 16 777 215
a2A3840-13gmPRO 16 777 215
a2A3840-45ucBAS 16 777 215
a2A3840-45ucPRO 16 777 215
a2A3840-45umBAS 16 777 215
a2A3840-45umPRO 16 777 215
a2A4504-5gcBAS 16 777 215
a2A4504-5gcPRO 16 777 215
a2A4504-5gmBAS 16 777 215
a2A4504-5gmPRO 16 777 215
a2A4504-18ucBAS 16 777 215
a2A4504-18ucPRO 16 777 215
a2A4504-18umBAS 16 777 215
a2A4504-18umPRO 16 777 215
a2A5320-7gcBAS 16 777 215
a2A5320-7gcPRO 16 777 215
a2A5320-7gmBAS 16 777 215
a2A5320-7gmPRO 16 777 215
a2A5320-23ucBAS 16 777 215
a2A5320-23ucPRO 16 777 215
a2A5320-23umBAS 16 777 215
a2A5320-23umPRO 16 777 215
a2A5328-4gcBAS 16 777 215
a2A5328-4gcPRO 16 777 215
a2A5328-4gmBAS 16 777 215
a2A5328-4gmPRO 16 777 215
a2A5328-15ucBAS 16 777 215
a2A5328-15ucPRO 16 777 215
a2A5328-15umBAS 16 777 215
a2A5328-15umPRO 16 777 215
acA640-90gc 4 095
acA640-90gm 4 095
acA640-90uc 16 777 215
acA640-90um 16 777 215
acA640-120gc 4 095
acA640-120gm 4 095
acA640-120uc 16 777 215
acA640-120um 16 777 215
acA640-121gm 16 777 215
acA640-300gc 16 777 215
acA640-300gm 16 777 215
acA640-750uc 16 777 215
acA640-750um 16 777 215
acA720-290gc 16 777 215
acA720-290gm 16 777 215
acA720-520uc 16 777 215
acA720-520um 16 777 215
acA780-75gc 4 095
acA780-75gm 4 095
acA800-200gc 16 777 215
acA800-200gm 16 777 215
acA800-510uc 16 777 215
acA800-510um 16 777 215
acA1280-60gc 4 095
acA1280-60gm 4 095
acA1300-22gc 4 095
acA1300-22gm 4 095
acA1300-30gc 4 095
acA1300-30gm 4 095
acA1300-30uc 16 777 215
acA1300-30um 16 777 215
acA1300-60gc 4 095
acA1300-60gm 4 095
acA1300-60gmNIR 4 095
acA1300-75gc 16 777 215
acA1300-75gm 16 777 215
acA1300-200uc 16 777 215
acA1300-200um 16 777 215
acA1440-73gc 16 777 215
acA1440-73gm 16 777 215
acA1440-220uc 16 777 215
acA1440-220um 16 777 215
acA1600-20gc 4 095
acA1600-20gm 4 095
acA1600-20uc 16 777 215
acA1600-20um 16 777 215
acA1600-60gc 4 095
acA1600-60gm 4 095
acA1920-25gc 4 095
acA1920-25gm 4 095
acA1920-25uc 16 777 215
acA1920-25um 16 777 215
acA1920-40gc 16 777 215
acA1920-40gm 16 777 215
acA1920-40uc 16 777 215
acA1920-40ucMED 16 777 215
acA1920-40um 16 777 215
acA1920-40umMED 16 777 215
acA1920-48gc 16 777 215
acA1920-48gm 16 777 215
acA1920-50gc 16 777 215
acA1920-50gm 16 777 215
acA1920-150uc 16 777 215
acA1920-150um 16 777 215
acA1920-155uc 16 777 215
acA1920-155ucMED 16 777 215
acA1920-155um 16 777 215
acA1920-155umMED 16 777 215
acA2000-50gc 4 095
acA2000-50gm 4 095
acA2000-50gmNIR 4 095
acA2000-165uc 16 777 215
acA2000-165um 16 777 215
acA2000-165umNIR 16 777 215
acA2040-25gc 4 095
acA2040-25gm 4 095
acA2040-25gmNIR 4 095
acA2040-35gc 16 777 215
acA2040-35gm 16 777 215
acA2040-55uc 16 777 215
acA2040-55um 16 777 215
acA2040-90uc 16 777 215
acA2040-90um 16 777 215
acA2040-90umNIR 16 777 215
acA2040-120uc 16 777 215
acA2040-120um 16 777 215
acA2440-20gc 16 777 215
acA2440-20gm 16 777 215
acA2440-35uc 16 777 215
acA2440-35ucMED 16 777 215
acA2440-35um 16 777 215
acA2440-35umMED 16 777 215
acA2440-75uc 16 777 215
acA2440-75ucMED 16 777 215
acA2440-75um 16 777 215
acA2440-75umMED 16 777 215
acA2500-14gc 4 095
acA2500-14gm 4 095
acA2500-14uc 16 777 215
acA2500-14um 16 777 215
acA2500-20gc 16 777 215
acA2500-20gcMED 16 777 215
acA2500-20gm 16 777 215
acA2500-20gmMED 16 777 215
acA2500-60uc 16 777 215
acA2500-60um 16 777 215
acA3088-16gc 16 777 215
acA3088-16gm 16 777 215
acA3088-57uc 16 777 215
acA3088-57um 16 777 215
acA3800-10gc 4 095
acA3800-10gm 4 095
acA3800-14uc 16 777 215
acA3800-14um 16 777 215
acA4024-8gc 16 777 215
acA4024-8gm 16 777 215
acA4024-29uc 16 777 215
acA4024-29um 16 777 215
acA4096-11gc 16 777 215
acA4096-11gm 16 777 215
acA4096-30uc 16 777 215
acA4096-30ucMED 16 777 215
acA4096-30um 16 777 215
acA4096-30umMED 16 777 215
acA4096-40uc 16 777 215
acA4096-40ucMED 16 777 215
acA4096-40um 16 777 215
acA4096-40umMED 16 777 215
acA4112-8gc 16 777 215
acA4112-8gm 16 777 215
acA4112-20uc 16 777 215
acA4112-20ucMED 16 777 215
acA4112-20um 16 777 215
acA4112-20umMED 16 777 215
acA4112-30uc 16 777 215
acA4112-30ucMED 16 777 215
acA4112-30um 16 777 215
acA4112-30umMED 16 777 215
acA4600-7gc 4 095
acA4600-10uc 16 777 215
acA5472-5gc 16 777 215
acA5472-5gm 16 777 215
acA5472-17uc 16 777 215
acA5472-17um 16 777 215
boA4096-93cc 16 777 215
boA4096-93cm 16 777 215
boA4112-68cc 16 777 215
boA4112-68cm 16 777 215
daA1280-54lc 不支持 Timer 功能
daA1280-54lm 不支持 Timer 功能
daA1280-54uc 不支持 Timer 功能
daA1280-54um 不支持 Timer 功能
daA1600-60lc 不支持 Timer 功能
daA1600-60lm 16 777 215
daA1600-60uc 不支持 Timer 功能
daA1600-60um 不支持 Timer 功能
daA1920-15um 不支持 Timer 功能
daA1920-30uc 不支持 Timer 功能
daA1920-30um 不支持 Timer 功能
daA1920-160uc 16 777 215
daA1920-160um 16 777 215
daA2500-14lc 不支持 Timer 功能
daA2500-14lm 不支持 Timer 功能
daA2500-14uc 不支持 Timer 功能
daA2500-14um 不支持 Timer 功能
daA2500-60mc 不支持 Timer 功能
daA2500-60mci 不支持 Timer 功能
daA4200-30mci 不支持 Timer 功能
puA1280-54uc 不支持 Timer 功能
puA1280-54um 不支持 Timer 功能
puA1600-60uc 不支持 Timer 功能
puA1600-60um 不支持 Timer 功能
puA1920-30uc 不支持 Timer 功能
puA1920-30um 不支持 Timer 功能
puA2500-14uc 不支持 Timer 功能
puA2500-14um 不支持 Timer 功能

示例代码#

ace 2、boost 和 dart IMX 相机#

// Select Timer 1
camera.TimerSelector.SetValue(TimerSelector_Timer1);
// Set the timer duration to 1000 microseconds
camera.TimerDuration.SetValue(1000.0);
// Set the timer delay to 500 microseconds
camera.TimerDelay.SetValue(500.0);
// Set the timer trigger arm delay to 5000 microseconds
camera.TimerTriggerArmDelay.SetValue(5000.0);
// Select Line 2 and configure the line as output
camera.LineSelector.SetValue(LineSelector_Line2);
camera.LineMode.SetValue(LineMode_Output);
// Specify that the timer signal is output on Line 2
camera.LineSource.SetValue(LineSource_Timer1Active);
// Specify that the timer starts whenever a rising signal is detected on Line 1
camera.TimerTriggerSource.SetValue(TimerTriggerSource_Line1);
camera.TimerTriggerActivation.SetValue(TimerTriggerActivation_RisingEdge);
// Reset the timer
camera.TimerReset.Execute();
// Get the current status of the timer
TimerStatusEnums timerStatus = camera.TimerStatus.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Select Timer 1
CEnumerationPtr(nodemap.GetNode("TimerSelector"))->FromString("Timer1");
// Set the timer duration to 1000 microseconds
CFloatPtr(nodemap.GetNode("TimerDuration"))->SetValue(1000.0);
// Set the timer delay to 500 microseconds
CFloatPtr(nodemap.GetNode("TimerDelay"))->SetValue(500.0);
// Set the timer trigger arm delay to 5000 microseconds
CFloatPtr(nodemap.GetNode("TimerTriggerArmDelay"))->SetValue(5000.0);
// Select Line 2 and configure the line as output
CEnumerationPtr(nodemap.GetNode("LineSelector"))->FromString("Line2");
CEnumerationPtr(nodemap.GetNode("LineMode"))->FromString("Output");
// Specify that the timer signal is output on Line 2
CEnumerationPtr(nodemap.GetNode("LineSource"))->FromString("Timer1Active");
// Specify that the timer starts whenever a rising signal is detected on Line 1
CEnumerationPtr(nodemap.GetNode("TimerTriggerSource"))->FromString("Line1");
CEnumerationPtr(nodemap.GetNode("TimerTriggerActivation"))->FromString("RisingEdge");
// Reset the timer
CCommandPtr(nodemap.GetNode("TimerReset"))->Execute();
// Get the current status of the timer
String_t timerStatus = CEnumerationPtr(nodemap.GetNode("TimerStatus"))->ToString();
INodeMap& nodemap = camera.GetNodeMap();
// Select Timer 1
CEnumParameter(nodemap, "TimerSelector").SetValue("Timer1");
// Set the timer duration to 1000 microseconds
CFloatParameter(nodemap, "TimerDuration").SetValue(1000.0);
// Set the timer delay to 500 microseconds
CFloatParameter(nodemap, "TimerDelay").SetValue(500.0);
// Set the timer trigger arm delay to 5000 microseconds
CFloatParameter(nodemap, "TimerTriggerArmDelay").SetValue(5000.0);
// Select Line 2 and configure the line as output
CEnumParameter(nodemap, "LineSelector").SetValue("Line2");
CEnumParameter(nodemap, "LineMode").SetValue("Output");
// Specify that the timer signal is output on Line 2
CEnumParameter(nodemap, "LineSource").SetValue("Timer1Active");
// Specify that the timer starts whenever a rising signal is detected on Line 1
CEnumParameter(nodemap, "TimerTriggerSource").SetValue("Line1");
CEnumParameter(nodemap, "TimerTriggerActivation").SetValue("RisingEdge");
// Reset the timer
CCommandParameter(nodemap, "TimerReset").Execute();
// Get the current status of the timer
String_t timerStatus = CEnumParameter(nodemap, "TimerStatus").GetValue();
// Select Timer 1
camera.Parameters[PLCamera.TimerSelector].SetValue(PLCamera.TimerSelector.Timer1);
// Set the timer duration to 1000 microseconds
camera.Parameters[PLCamera.TimerDuration].SetValue(1000.0);
// Set the timer delay to 500 microseconds
camera.Parameters[PLCamera.TimerDelay].SetValue(500.0);
// Set the timer trigger arm delay to 5000 microseconds
camera.Parameters[PLCamera.TimerTriggerArmDelay].SetValue(5000.0);
// Select Line 2 and configure the line as output
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line2);
camera.Parameters[PLCamera.LineMode].SetValue(PLCamera.LineMode.Output);
// Specify that the timer signal is output on Line 2
camera.Parameters[PLCamera.LineSource].SetValue(PLCamera.LineSource.Timer1Active);
// Specify that the timer starts whenever a rising signal is detected on Line 1
camera.Parameters[PLCamera.TimerTriggerSource].SetValue(PLCamera.TimerTriggerSource.Line1);
camera.Parameters[PLCamera.TimerTriggerActivation].SetValue(PLCamera.TimerTriggerActivation.RisingEdge);
// Reset the timer
camera.Parameters[PLCamera.TimerReset].Execute();
// Get the current status of the timer
string timerStatus = camera.Parameters[PLCamera.TimerStatus].GetValue();
// Select Timer 1
Pylon.DeviceFeatureFromString(hdev, "TimerSelector", "Timer1");
// Set the timer duration to 1000 microseconds
Pylon.DeviceSetFloatFeature(hdev, "TimerDuration", 1000.0);
// Set the timer delay to 500 microseconds
Pylon.DeviceSetFloatFeature(hdev, "TimerDelay", 500.0);
// Set the timer trigger arm delay to 5000 microseconds
Pylon.DeviceSetFloatFeature(hdev, "TimerTriggerArmDelay", 5000.0);
// Select Line 2 and configure the line as output
Pylon.DeviceFeatureFromString(hdev, "LineSelector", "Line2");
Pylon.DeviceFeatureFromString(hdev, "LineMode", "Output");
// Specify that the timer signal is output on Line 2
Pylon.DeviceFeatureFromString(hdev, "LineSource", "Timer1Active");
// Specify that the timer starts whenever a rising signal is detected on Line 1
Pylon.DeviceFeatureFromString(hdev, "TimerTriggerSource", "Line1");
Pylon.DeviceFeatureFromString(hdev, "TimerTriggerActivation", "RisingEdge");
// Reset the timer
Pylon.DeviceExecuteCommandFeature(hdev, "TimerReset");
// Get the current status of the timer
string timerStatus = Pylon.DeviceFeatureToString(hdev, "TimerStatus");
/* 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 */
size_t len = 0;
char timerStatus_str[64] = {0};
/* Select Timer 1 */
errRes = PylonDeviceFeatureFromString(hdev, "TimerSelector", "Timer1");
CHECK(errRes);
/* Set the timer duration to 1000 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "TimerDuration", 1000.0);
CHECK(errRes);
/* Set the timer delay to 500 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "TimerDelay", 500.0);
CHECK(errRes);
/* Set the timer trigger arm delay to 5000 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "TimerTriggerArmDelay", 5000.0);
CHECK(errRes);
/* Select Line 2 and configure the line as output */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line2");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "LineMode", "Output");
CHECK(errRes);
/* Specify that the timer signal is output on Line 2 */
errRes = PylonDeviceFeatureFromString(hdev, "LineSource", "Timer1Active");
CHECK(errRes);
/* Specify that the timer starts whenever a rising signal is detected on Line 1 */
errRes = PylonDeviceFeatureFromString(hdev, "TimerTriggerSource", "Line1");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "TimerTriggerActivation", "RisingEdge");
CHECK(errRes);
/* Reset the timer */
errRes = PylonDeviceExecuteCommandFeature(hdev, "TimerReset");
CHECK(errRes);
/* Get the current status of the timer */
len = sizeof(timerStatus_str);
errRes = PylonDeviceFeatureToString(hdev, "TimerStatus", timerStatus_str, &len);
CHECK(errRes);

ace classic/U/L GigE 相机#

// Select Line 2 (output line)
camera.LineSelector.SetValue(LineSelector_Line2);
// Specify that the timer signal is output on Line 2
camera.LineSource.SetValue(LineSource_TimerActive);
// Specify that the timer starts when exposure starts
camera.TimerTriggerSource.SetValue(TimerTriggerSource_ExposureStart);
// Set the timer duration to 1000 microseconds
camera.TimerDurationAbs.SetValue(1000.0);
// Set the timer delay to 500 microseconds
camera.TimerDelayAbs.SetValue(500.0);
INodeMap& nodemap = camera.GetNodeMap();
// Select Line 2 (output line)
CEnumerationPtr(nodemap.GetNode("LineSelector"))->FromString("Line2");
// Specify that the timer signal is output on Line 2
CEnumerationPtr(nodemap.GetNode("LineSource"))->FromString("TimerActive");
// Specify that the timer starts when exposure starts
CEnumerationPtr(nodemap.GetNode("TimerTriggerSource"))->FromString("ExposureStart");
// Set the timer duration to 1000 microseconds
CFloatPtr(nodemap.GetNode("TimerDurationAbs"))->SetValue(1000.0);
// Set the timer delay to 500 microseconds
CFloatPtr(nodemap.GetNode("TimerDelayAbs"))->SetValue(500.0);
INodeMap& nodemap = camera.GetNodeMap();
// Select Line 2 (output line)
CEnumParameter(nodemap, "LineSelector").SetValue("Line2");
// Specify that the timer signal is output on Line 2
CEnumParameter(nodemap, "LineSource").SetValue("TimerActive");
// Specify that the timer starts when exposure starts
CEnumParameter(nodemap, "TimerTriggerSource").SetValue("ExposureStart");
// Set the timer duration to 1000 microseconds
CFloatParameter(nodemap, "TimerDurationAbs").SetValue(1000.0);
// Set the timer delay to 500 microseconds
CFloatParameter(nodemap, "TimerDelayAbs").SetValue(500.0);
// Select Line 2 (output line)
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line2);
// Specify that the timer signal is output on Line 2
camera.Parameters[PLCamera.LineSource].SetValue(PLCamera.LineSource.TimerActive);
// Specify that the timer starts when exposure starts
camera.Parameters[PLCamera.TimerTriggerSource].SetValue(PLCamera.TimerTriggerSource.ExposureStart);
// Set the timer duration to 1000 microseconds
camera.Parameters[PLCamera.TimerDurationAbs].SetValue(1000.0);
// Set the timer delay to 500 microseconds
camera.Parameters[PLCamera.TimerDelayAbs].SetValue(500.0);
// Select Line 2 (output line)
Pylon.DeviceFeatureFromString(hdev, "LineSelector", "Line2");
// Specify that the timer signal is output on Line 2
Pylon.DeviceFeatureFromString(hdev, "LineSource", "TimerActive");
// Specify that the timer starts when exposure starts
Pylon.DeviceFeatureFromString(hdev, "TimerTriggerSource", "ExposureStart");
// Set the timer duration to 1000 microseconds
Pylon.DeviceSetFloatFeature(hdev, "TimerDurationAbs", 1000.0);
// Set the timer delay to 500 microseconds
Pylon.DeviceSetFloatFeature(hdev, "TimerDelayAbs", 500.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 Line 2 (output line) */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line2");
CHECK(errRes);
/* Specify that the timer signal is output on Line 2 */
errRes = PylonDeviceFeatureFromString(hdev, "LineSource", "TimerActive");
CHECK(errRes);
/* Specify that the timer starts when exposure starts */
errRes = PylonDeviceFeatureFromString(hdev, "TimerTriggerSource", "ExposureStart");
CHECK(errRes);
/* Set the timer duration to 1000 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "TimerDurationAbs", 1000.0);
CHECK(errRes);
/* Set the timer delay to 500 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "TimerDelayAbs", 500.0);
CHECK(errRes);

其他相机#

// Select Line 2 (output line)
camera.LineSelector.SetValue(LineSelector_Line2);
// Specify that the timer signal is output on Line 2
camera.LineSource.SetValue(LineSource_Timer1Active);
// Specify that the timer starts when exposure starts
camera.TimerTriggerSource.SetValue(TimerTriggerSource_ExposureStart);
// Set the timer duration to 1000 microseconds
camera.TimerDuration.SetValue(1000.0);
// Set the timer delay to 500 microseconds
camera.TimerDelay.SetValue(500.0);
INodeMap& nodemap = camera.GetNodeMap();
// Select Line 2 (output line)
CEnumerationPtr(nodemap.GetNode("LineSelector"))->FromString("Line2");
// Specify that the timer signal is output on Line 2
CEnumerationPtr(nodemap.GetNode("LineSource"))->FromString("Timer1Active");
// Specify that the timer starts when exposure starts
CEnumerationPtr(nodemap.GetNode("TimerTriggerSource"))->FromString("ExposureStart");
// Set the timer duration to 1000 microseconds
CFloatPtr(nodemap.GetNode("TimerDuration"))->SetValue(1000.0);
// Set the timer delay to 500 microseconds
CFloatPtr(nodemap.GetNode("TimerDelay"))->SetValue(500.0);
INodeMap& nodemap = camera.GetNodeMap();
// Select Line 2 (output line)
CEnumParameter(nodemap, "LineSelector").SetValue("Line2");
// Specify that the timer signal is output on Line 2
CEnumParameter(nodemap, "LineSource").SetValue("Timer1Active");
// Specify that the timer starts when exposure starts
CEnumParameter(nodemap, "TimerTriggerSource").SetValue("ExposureStart");
// Set the timer duration to 1000 microseconds
CFloatParameter(nodemap, "TimerDuration").SetValue(1000.0);
// Set the timer delay to 500 microseconds
CFloatParameter(nodemap, "TimerDelay").SetValue(500.0);
// Select Line 2 (output line)
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line2);
// Specify that the timer signal is output on Line 2
camera.Parameters[PLCamera.LineSource].SetValue(PLCamera.LineSource.Timer1Active);
// Specify that the timer starts when exposure starts
camera.Parameters[PLCamera.TimerTriggerSource].SetValue(PLCamera.TimerTriggerSource.ExposureStart);
// Set the timer duration to 1000 microseconds
camera.Parameters[PLCamera.TimerDuration].SetValue(1000.0);
// Set the timer delay to 500 microseconds
camera.Parameters[PLCamera.TimerDelay].SetValue(500.0);
// Select Line 2 (output line)
Pylon.DeviceFeatureFromString(hdev, "LineSelector", "Line2");
// Specify that the timer signal is output on Line 2
Pylon.DeviceFeatureFromString(hdev, "LineSource", "Timer1Active");
// Specify that the timer starts when exposure starts
Pylon.DeviceFeatureFromString(hdev, "TimerTriggerSource", "ExposureStart");
// Set the timer duration to 1000 microseconds
Pylon.DeviceSetFloatFeature(hdev, "TimerDuration", 1000.0);
// Set the timer delay to 500 microseconds
Pylon.DeviceSetFloatFeature(hdev, "TimerDelay", 500.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 Line 2 (output line) */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line2");
CHECK(errRes);
/* Specify that the timer signal is output on Line 2 */
errRes = PylonDeviceFeatureFromString(hdev, "LineSource", "Timer1Active");
CHECK(errRes);
/* Specify that the timer starts when exposure starts */
errRes = PylonDeviceFeatureFromString(hdev, "TimerTriggerSource", "ExposureStart");
CHECK(errRes);
/* Set the timer duration to 1000 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "TimerDuration", 1000.0);
CHECK(errRes);
/* Set the timer delay to 500 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "TimerDelay", 500.0);
CHECK(errRes);

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