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.
Set the TimerSelector parameter to the desired timer, e.g., Timer1.
Set the TimerTriggerSource parameter to the source that you want to use to start the timer, e.g., Line2.
If applicable, set the TimerTriggerActivation parameter to one of the following values:
RisingEdge (default): The timer starts when the signal rises, i.e., when the signal status changes from low to high.
FallingEdge: The timer starts when the signal falls, i.e., when the signal status changes from high to low.
AnyEdge: The timer starts when the signal falls or rises.
LevelHigh: The timer starts when the signal is high. When the signal changes to low, the timer stops and must be started again.
LevelLow: The timer starts when the signal is low. When the signal changes to high, the timer stops and must be started again.
Start the timer by sending a signal on the selected trimer trigger 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.
Info
The TimerTriggerActivation parameter is only available for timer trigger sources that can be high (1) or low (0), i.e., an I/O signal or an "Active" signal like ExposureActive.
To get the current status of a timer, get the value of the TimerStatus parameter. This parameter is read-only.
Possible values are:
TimerTriggerWait: The timer is waiting to be started.
TimerActive: The timer has been started. A timer immediately switches to this state when the trigger source event occurs, regardless of the delay set. If an arm delay is set, the timer remains in the TimerActive state until the arm delay has expired.
TimerIdle: The timer is idle. A timer is in this state whenever the TimerTriggerSource parameter is set o Off, i.e., the timer can't be started.
To increase the maximum timer duration on these models:
Divide the desired timer duration by 4 095 and round up the result to the nearest integer. Example: Assume you want to set a timer duration of 50 000 µs. 50000 / 4095 = 12.21 ≈ 13.
Set the TimerDurationTimebaseAbs parameter to the value determined in step 1, in this case 13.
Set the TimerDurationAbs parameter to the desired timer duration, in this case 50 000. Internally, the camera calculates the timer duration as follows: TimerDurationRaw x TimerDurationTimebaseAbs = TimerDurationAbs.
To increase the maximum timer delay on these models:
Divide the desired timer delay by 4 095 and round up the result to the nearest integer. Example: Assume you want to set a timer delay of 6 000 µs. 6000 / 4095 = 1.47 ≈ 2.
Set the TimerDelayTimebaseAbs parameter to the value determined in step 1, in this case 2.
Set the TimerDelayAbs parameter to the desired timer delay, in this case 6 000. Internally, the camera calculates the timer delay as follows: TimerDelayRaw x TimerDelayTimebaseAbs = TimerDelayAbs.
Info
Depending on the TimerDurationTimebaseAbs and TimerDelayTimebaseAbs parameter values, the camera may not be able to achieve the exact timer duration and delay desired. For example, if you set the TimerDurationTimebaseAbs parameter to 13, the camera can only achieve timer durations that are a multiple of 13. Therefore, if you set the TimerDurationAbs parameter to 50 000 and the TimerDurationTimebaseAbs parameter to 13, the camera will automatically change the setting to the nearest possible value (e.g., 49 998, which is the nearest multiple of 13).
TimerSelector: Sets which timer to configure. Because Basler ace Classic/U/L cameras support only one timer, this parameter is preset and can't be changed.
// Select Timer 1camera.TimerSelector.SetValue(TimerSelector_Timer1);// Set the timer duration to 1000 microsecondscamera.TimerDuration.SetValue(1000.0);// Set the timer delay to 500 microsecondscamera.TimerDelay.SetValue(500.0);// Set the timer trigger arm delay to 5000 microsecondscamera.TimerTriggerArmDelay.SetValue(5000.0);// Select Line 2 and configure the line as outputcamera.LineSelector.SetValue(LineSelector_Line2);camera.LineMode.SetValue(LineMode_Output);// Specify that the timer signal is output on Line 2camera.LineSource.SetValue(LineSource_Timer1Active);// Specify that the timer starts whenever a rising signal is detected on Line 1camera.TimerTriggerSource.SetValue(TimerTriggerSource_Line1);camera.TimerTriggerActivation.SetValue(TimerTriggerActivation_RisingEdge);// Reset the timercamera.TimerReset.Execute();// Get the current status of the timerTimerStatusEnumstimerStatus=camera.TimerStatus.GetValue();
INodeMap&nodemap=camera.GetNodeMap();// Select Timer 1CEnumParameter(nodemap,"TimerSelector").SetValue("Timer1");// Set the timer duration to 1000 microsecondsCFloatParameter(nodemap,"TimerDuration").SetValue(1000.0);// Set the timer delay to 500 microsecondsCFloatParameter(nodemap,"TimerDelay").SetValue(500.0);// Set the timer trigger arm delay to 5000 microsecondsCFloatParameter(nodemap,"TimerTriggerArmDelay").SetValue(5000.0);// Select Line 2 and configure the line as outputCEnumParameter(nodemap,"LineSelector").SetValue("Line2");CEnumParameter(nodemap,"LineMode").SetValue("Output");// Specify that the timer signal is output on Line 2CEnumParameter(nodemap,"LineSource").SetValue("Timer1Active");// Specify that the timer starts whenever a rising signal is detected on Line 1CEnumParameter(nodemap,"TimerTriggerSource").SetValue("Line1");CEnumParameter(nodemap,"TimerTriggerActivation").SetValue("RisingEdge");// Reset the timerCCommandParameter(nodemap,"TimerReset").Execute();// Get the current status of the timerString_ttimerStatus=CEnumParameter(nodemap,"TimerStatus").GetValue();
// Select Timer 1camera.Parameters[PLCamera.TimerSelector].SetValue(PLCamera.TimerSelector.Timer1);// Set the timer duration to 1000 microsecondscamera.Parameters[PLCamera.TimerDuration].SetValue(1000.0);// Set the timer delay to 500 microsecondscamera.Parameters[PLCamera.TimerDelay].SetValue(500.0);// Set the timer trigger arm delay to 5000 microsecondscamera.Parameters[PLCamera.TimerTriggerArmDelay].SetValue(5000.0);// Select Line 2 and configure the line as outputcamera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line2);camera.Parameters[PLCamera.LineMode].SetValue(PLCamera.LineMode.Output);// Specify that the timer signal is output on Line 2camera.Parameters[PLCamera.LineSource].SetValue(PLCamera.LineSource.Timer1Active);// Specify that the timer starts whenever a rising signal is detected on Line 1camera.Parameters[PLCamera.TimerTriggerSource].SetValue(PLCamera.TimerTriggerSource.Line1);camera.Parameters[PLCamera.TimerTriggerActivation].SetValue(PLCamera.TimerTriggerActivation.RisingEdge);// Reset the timercamera.Parameters[PLCamera.TimerReset].Execute();// Get the current status of the timerstringtimerStatus=camera.Parameters[PLCamera.TimerStatus].GetValue();
/* Macro to check for errors */#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)GENAPIC_RESULTerrRes=GENAPI_E_OK;/* Return value of pylon methods */size_tlen=0;chartimerStatus_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);
# Select Timer 1camera.TimerSelector.Value="Timer1"# Set the timer duration to 1000 microsecondscamera.TimerDuration.Value=1000.0# Set the timer delay to 500 microsecondscamera.TimerDelay.Value=500.0# Set the timer trigger arm delay to 5000 microsecondscamera.TimerTriggerArmDelay.Value=5000.0# Select Line 2 and configure the line as outputcamera.LineSelector.Value="Line2"camera.LineMode.Value="Output"# Specify that the timer signal is output on Line 2camera.LineSource.Value="Timer1Active"# Specify that the timer starts whenever a rising signal is detected on Line 1camera.TimerTriggerSource.Value="Line1"camera.TimerTriggerActivation.Value="RisingEdge"# Reset the timercamera.TimerReset.Execute()# Get the current status of the timertimerStatus=camera.TimerStatus.Value
// Select Line 2 (output line)camera.LineSelector.SetValue(LineSelector_Line2);// Specify that the timer signal is output on Line 2camera.LineSource.SetValue(LineSource_TimerActive);// Specify that the timer starts when exposure startscamera.TimerTriggerSource.SetValue(TimerTriggerSource_ExposureStart);// Set the timer duration to 1000 microsecondscamera.TimerDurationAbs.SetValue(1000.0);// Set the timer delay to 500 microsecondscamera.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 2CEnumParameter(nodemap,"LineSource").SetValue("TimerActive");// Specify that the timer starts when exposure startsCEnumParameter(nodemap,"TimerTriggerSource").SetValue("ExposureStart");// Set the timer duration to 1000 microsecondsCFloatParameter(nodemap,"TimerDurationAbs").SetValue(1000.0);// Set the timer delay to 500 microsecondsCFloatParameter(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 2camera.Parameters[PLCamera.LineSource].SetValue(PLCamera.LineSource.TimerActive);// Specify that the timer starts when exposure startscamera.Parameters[PLCamera.TimerTriggerSource].SetValue(PLCamera.TimerTriggerSource.ExposureStart);// Set the timer duration to 1000 microsecondscamera.Parameters[PLCamera.TimerDurationAbs].SetValue(1000.0);// Set the timer delay to 500 microsecondscamera.Parameters[PLCamera.TimerDelayAbs].SetValue(500.0);
/* Macro to check for errors */#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)GENAPIC_RESULTerrRes=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.Value="Line2"# Specify that the timer signal is output on Line 2camera.LineSource.Value="TimerActive"# Specify that the timer starts when exposure startscamera.TimerTriggerSource.Value="ExposureStart"# Set the timer duration to 1000 microsecondscamera.TimerDurationAbs.Value=1000.0# Set the timer delay to 500 microsecondscamera.TimerDelayAbs.Value=500.0
// Select Line 2 (output line)camera.LineSelector.SetValue(LineSelector_Line2);// Specify that the timer signal is output on Line 2camera.LineSource.SetValue(LineSource_Timer1Active);// Specify that the timer starts when exposure startscamera.TimerTriggerSource.SetValue(TimerTriggerSource_ExposureStart);// Set the timer duration to 1000 microsecondscamera.TimerDuration.SetValue(1000.0);// Set the timer delay to 500 microsecondscamera.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 2CEnumParameter(nodemap,"LineSource").SetValue("Timer1Active");// Specify that the timer starts when exposure startsCEnumParameter(nodemap,"TimerTriggerSource").SetValue("ExposureStart");// Set the timer duration to 1000 microsecondsCFloatParameter(nodemap,"TimerDuration").SetValue(1000.0);// Set the timer delay to 500 microsecondsCFloatParameter(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 2camera.Parameters[PLCamera.LineSource].SetValue(PLCamera.LineSource.Timer1Active);// Specify that the timer starts when exposure startscamera.Parameters[PLCamera.TimerTriggerSource].SetValue(PLCamera.TimerTriggerSource.ExposureStart);// Set the timer duration to 1000 microsecondscamera.Parameters[PLCamera.TimerDuration].SetValue(1000.0);// Set the timer delay to 500 microsecondscamera.Parameters[PLCamera.TimerDelay].SetValue(500.0);
/* Macro to check for errors */#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)GENAPIC_RESULTerrRes=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);
# Select Line 2 (output line)camera.LineSelector.Value="Line2"# Specify that the timer signal is output on Line 2camera.LineSource.Value="Timer1Active"# Specify that the timer starts when exposure startscamera.TimerTriggerSource.Value="ExposureStart"# Set the timer duration to 1000 microsecondscamera.TimerDuration.Value=1000.0# Set the timer delay to 500 microsecondscamera.TimerDelay.Value=500.0