Timer (ace 2, boost)

The Timer camera feature allows you to configure a timer output signal that goes high on specific camera events and goes low after a specific duration.

For a description of the Timer feature for ace classic/U/L cameras, click here.

In this topic Hide

Using the Feature

How It Works

Two timers are available, Timer 1 and Timer 2.

This is how a timer works:

Timer Operation

Configuring a Timer

To configure a timer:

  1. Set the TimerSelector parameter to the desired timer, e.g., Timer1.
  2. Set the TimerDuration parameter to the desired timer duration in microseconds.
  3. Set the TimerDelay parameter to the desired timer delay in microseconds.
  4. Set the TimerTriggerArmDelay parameter to the desired arm delay in microseconds.
  5. Set the LineSelector parameter to the output line that you want to use for the timer signal.
    If the line is a GPIO line, the line must be configured as output.
  6. If you selected Timer 1 in step 1, set the LineSource parameter to Timer1Active.
  7. If you selected Timer 2 in step 1, set the LineSource parameter to Timer2Active.

Starting a Timer

Timer Trigger Source

The TimerTriggerSource parameter allows you to specify which source starts the timer.

To specify the trigger source:

  1. Set the TimerSelector parameter to the desired timer, e.g., Timer1.
  2. Set the TimerTriggerSource parameter to the source that you want to use to start the timer.

Now, the timer starts whenever the camera detects a signal on the selected source.

When started, the timer's status immediately changes from TimerTriggerWait to TimerActive, regardless of the delay set. However, the timer output signal will only go high after the delay has expired.

Example 1: You set the TimerTriggerSource parameter to Line2. Now, the timer starts when the input or output signal on Line 2 changes.

Example 2: You set the TimerTriggerSource parameter to SoftwareSignal1. Now, the timer starts whenever you execute a SoftwareSignalPulse command via channel 1.

Timer Trigger Activation

By default, a timer only starts when a signal on the selected trigger source rises, i.e., when the signal status changes from low to high.

To change this behavior, set the TimerTriggerActivation parameter to one of the following values:

The TimerTriggerActivation parameter is only available for timer trigger sources that can be high (0) or low (1), i.e., an I/O signal or an "Active" signal like ExposureActive.

Resetting a Timer

To reset a timer, execute the TimerReset command.

The timer's status changes from TimerActive to TimerTriggerWait.

The timer can now be restarted immediately regardless of the arm delay set.

Getting the Status of a Timer

To get the current status of a timer, get the value of the TimerStatus parameter. This parameter is read-only.

Possible values are:

Sample Code

// 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();
// 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);

You can also use the pylon Viewer to easily set the parameters.