Periodic Signal#
This allows you to, e.g., capture images on multiple cameras at the same time and the same frame rate.
This feature is similar to the Synchronous Free Run feature, but apart from image acquisition it can also be used for other purposes.
Using the Feature#
How It Works#
Basler cameras supporting the Periodic Signal feature provide an additional camera signal source, PeriodicSignal1
. Via this source, the camera transmits a signal with the following characteristics:
- The signal is repetitive.
- The signal can be synchronized across devices via Precision Time Protocol.
- The period of the signal can be configured.
- The delay before the first period can be configured.
The PeriodicSignal1
signal source can be used for many different purposes, e.g., to synchronize counters or image acquisition across devices.
Using Periodic Signal to Synchronize Image Acquisition#
To synchronize image acquisition on multiple cameras:
- Open one of the cameras that you want to synchronize using Periodic Signal.
- Make sure that the
BslPeriodicSignalSource
parameter on the camera is set toPtpClock
.
This indicates that the camera is synchronized via the Precision Time Protocol feature. - Set the
BslPeriodicSignalPeriod
parameter to the reciprocal of the desired frame rate, converted to microseconds. For example, if you want to synchronize the cameras at 50 frames per second, set the parameter to 20000 (1 / 50 = 0.02 seconds = 20000 microseconds). You must specify the same parameter value on all cameras. - Configure the periodic signal delay:
- If you want all cameras to acquire images at the same time, set the
BslPeriodicSignalDelay
parameter to 0 on all cameras. - If you want all cameras to acquire images sequentially, i.e, in regular intervals, set the
BslPeriodicSignalDelay
parameter to 0 on the first camera and to multiples of the desired interval on the other cameras.
For example, assume you want to acquire images with an interval of 10000 µs between cameras. To do so, set the delay to 0 on the first camera, to 10000 on the second camera, to 20000 on the third camera, and so on.
- If you want all cameras to acquire images at the same time, set the
- Configure the camera to be triggered by the periodic signal:
- Set the
TriggerSelector
parameter toFrameStart
. - Set the
TriggerMode
parameter toOn
. - Set the
TriggerSource
parameter toPeriodicSignal1
.
- Set the
- Repeat steps 1 to 5 for all cameras.
Using Periodic Signal to Synchronously Trigger External Devices#
You can use the Periodic Signal feature to synchronously trigger external devices. This allows you to make non-PTP devices PTP-capable.
The camera's internal periodic signal can't be used as an I/O signal. However, you can trigger the camera's Timer feature using the periodic signal, and then use the timer signal as an I/O signal.
To do so:
- Open the camera that you want to use to trigger the external device.
- Make sure that the
BslPeriodicSignalSource
parameter on the camera is set toPtpClock
.
This indicates that the camera is synchronized via the Precision Time Protocol feature. - Set the
BslPeriodicSignalPeriod
parameter to the reciprocal of the desired trigger rate, converted to microseconds. For example, if you want to generate 20 trigger signals per second, set the parameter to 50000 (1/20 = 0.05 seconds = 50000 microseconds). - If you want to trigger the external device with a time delay, set the
BslPeriodicSignalDelay
parameter to the desired delay. - Configure the camera's Timer feature to be triggered by periodic signals:
- Set the
TimerSelector
parameter toTimer1
. - Set the
TimerDuration
parameter to the desired timer duration in microseconds.
The camera will send an I/O signal with a width equal to this value. Therefore, set a parameter value high enough for the external device to be able to receive the signal. In most cases, the default value of 10 µs should be sufficient. - Set the
TimerTriggerSource
parameter toPeriodicSignal1
.
- Set the
- Configure the camera to output the timer signal:
- Set the
LineSelector
parameter to the desired I/O line, e.g.,Line2
. The line must be configured as output. - Set the
LineSource
parameter toTimer1Active
.
- Set the
- Connect the external device to the output line selected in step 6.
The device now receives synchronized trigger signals on this line. - If you want to trigger another external device, repeat steps 1 to 6, using
Timer2
andTimer2Active
in steps 5 and 6.
Info
You can also synchronize image acquisition between cameras and synchronously trigger external devices using the same periodic signal. To do so, carry out both the procedures detailed above.
Additional Parameters#
BslPeriodicSignalSelector
: Sets the periodic signal channel to be configured. Because all Basler cameras currently offer one channel, this parameter is preset toPeriodicSignal1
and can't be changed.
Sample Code#
/* Using Periodic Signal to Synchronize Image Acquisition */
// Set the signal period to 20000 µs
camera.BslPeriodicSignalPeriod.SetValue(20000.0);
// Set the signal delay to 0
camera.BslPeriodicSignalDelay.SetValue(0);
// Configure the camera to be triggered by the periodic signal
camera.TriggerSelector.SetValue(TriggerSelector_FrameStart);
camera.TriggerMode.SetValue(TriggerMode_On);
camera.TriggerSource.SetValue(TriggerSource_PeriodicSignal1);
/* Using Periodic Signal to Synchronously Trigger External Devices */
// Set the signal period to 50000 µs
camera.BslPeriodicSignalPeriod.SetValue(50000.0);
// Set the signal delay to 0
camera.BslPeriodicSignalDelay.SetValue(0);
// Configure the camera's Timer feature to be triggered by periodic signals
camera.TimerSelector.SetValue(TimerSelector_Timer1);
camera.TimerDuration.SetValue(10.0);
camera.TimerTriggerSource.SetValue(TimerTriggerSource_PeriodicSignal1);
// Configure the camera to output the timer signal on Line 2
camera.LineSelector.SetValue(LineSelector_Line2);
camera.LineMode.SetValue(LineMode_Output);
camera.LineSource.SetValue(LineSource_Timer1Active);
INodeMap& nodemap = camera.GetNodeMap();
/*Using Periodic Signal to Synchronize Image Acquisition*/
CFloatParameter(nodemap, "BslPeriodicSignalPeriod").SetValue(20000.0);
// Set the signal delay to 0
CIntegerParameter(nodemap, "BslPeriodicSignalDelay").SetValue(0);
// Configure the camera to be triggered by the periodic signal
CEnumParameter(nodemap, "TriggerSelector").SetValue("FrameStart");
CEnumParameter(nodemap, "TriggerMode").SetValue("On");
CEnumParameter(nodemap, "TriggerSource").SetValue("PeriodicSignal1");
/*Using Periodic Signal to Synchronously Trigger External Devices*/
CFloatParameter(nodemap, "BslPeriodicSignalPeriod").SetValue(50000.0);
// Set the signal delay to 0
CIntegerParameter(nodemap, "BslPeriodicSignalDelay").SetValue(0);
// Configure the camera's Timer feature to be triggered by periodic signals
CEnumParameter(nodemap, "TimerSelector").SetValue("Timer1");
CFloatParameter(nodemap, "TimerDuration").SetValue(10.0);
CEnumParameter(nodemap, "TimerTriggerSource").SetValue("PeriodicSignal1");
// Configure the camera to output the timer signal on Line 2
CEnumParameter(nodemap, "LineSelector").SetValue("Line2");
CEnumParameter(nodemap, "LineMode").SetValue("Output");
CEnumParameter(nodemap, "LineSource").SetValue("Timer1Active");
/*Using Periodic Signal to Synchronize Image Acquisition*/
camera.Parameters[PLCamera.BslPeriodicSignalPeriod].SetValue(20000.0);
// Set the signal delay to 0
camera.Parameters[PLCamera.BslPeriodicSignalDelay].SetValue(0);
// Configure the camera to be triggered by the periodic signal
camera.Parameters[PLCamera.TriggerSelector].SetValue(PLCamera.TriggerSelector.FrameStart);
camera.Parameters[PLCamera.TriggerMode].SetValue(PLCamera.TriggerMode.On);
camera.Parameters[PLCamera.TriggerSource].SetValue(PLCamera.TriggerSource.PeriodicSignal1);
/*Using Periodic Signal to Synchronously Trigger External Devices*/
camera.Parameters[PLCamera.BslPeriodicSignalPeriod].SetValue(50000.0);
// Set the signal delay to 0
camera.Parameters[PLCamera.BslPeriodicSignalDelay].SetValue(0);
// Configure the camera's Timer feature to be triggered by periodic signals
camera.Parameters[PLCamera.TimerSelector].SetValue(PLCamera.TimerSelector.Timer1);
camera.Parameters[PLCamera.TimerDuration].SetValue(10.0);
camera.Parameters[PLCamera.TimerTriggerSource].SetValue(PLCamera.TimerTriggerSource.PeriodicSignal1);
// Configure the camera to output the timer signal on Line 2
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line2);
camera.Parameters[PLCamera.LineMode].SetValue(PLCamera.LineMode.Output);
camera.Parameters[PLCamera.LineSource].SetValue(PLCamera.LineSource.Timer1Active);
/* 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 */
/*Using Periodic Signal to Synchronize Image Acquisition*/
errRes = PylonDeviceSetFloatFeature(hdev, "BslPeriodicSignalPeriod", 20000.0);
CHECK(errRes);
/* Set the signal delay to 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslPeriodicSignalDelay", 0);
CHECK(errRes);
/* Configure the camera to be triggered by the periodic signal */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerSelector", "FrameStart");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "TriggerMode", "On");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "TriggerSource", "PeriodicSignal1");
CHECK(errRes);
/*Using Periodic Signal to Synchronously Trigger External Devices*/
errRes = PylonDeviceSetFloatFeature(hdev, "BslPeriodicSignalPeriod", 50000.0);
CHECK(errRes);
/* Set the signal delay to 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslPeriodicSignalDelay", 0);
CHECK(errRes);
/* Configure the camera's Timer feature to be triggered by periodic signals */
errRes = PylonDeviceFeatureFromString(hdev, "TimerSelector", "Timer1");
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "TimerDuration", 10.0);
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "TimerTriggerSource", "PeriodicSignal1");
CHECK(errRes);
/* Configure the camera to output the timer signal on Line 2 */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line2");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "LineMode", "Output");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "LineSource", "Timer1Active");
CHECK(errRes);
# Using Periodic Signal to Synchronize Image Acquisition
camera.BslPeriodicSignalPeriod.Value = 20000.0
# Set the signal delay to 0
camera.BslPeriodicSignalDelay.Value = 0
# Configure the camera to be triggered by the periodic signal
camera.TriggerSelector.Value = "FrameStart"
camera.TriggerMode.Value = "On"
camera.TriggerSource.Value = "PeriodicSignal1"
# Using Periodic Signal to Synchronously Trigger External Devices
camera.BslPeriodicSignalPeriod.Value = 50000.0
# Set the signal delay to 0
camera.BslPeriodicSignalDelay.Value = 0
# Configure the camera's Timer feature to be triggered by periodic signals
camera.TimerSelector.Value = "Timer1"
camera.TimerDuration.Value = 10.0
camera.TimerTriggerSource.Value = "PeriodicSignal1"
# Configure the camera to output the timer signal on Line 2
camera.LineSelector.Value = "Line2"
camera.LineMode.Value = "Output"
camera.LineSource.Value = "Timer1Active"
You can also use the pylon Viewer to easily set the parameters.