Frequency Converter#
The frequency converter can accept trigger signals from different sources, e.g., from the camera's encoder control, counter, or timer. Receiving signals from the encoder control is the most common use case.
The feature is only available on Basler racer 2 cameras.
Using the Feature#
How It Works#
The frequency converter adapts the trigger rate of signals received to a trigger rate that is suitable for use in other applications. This is done by means of division and multiplication.
The frequency converter includes three modules acting in sequence on the original signals: the pre-divider, the multiplier, and the post-divider
Pre-Divider Module#
The pre-divider module receives the input signals. The module allows you to apply an integer factor, the pre-divider, to decrease the original frequencies and passes the signals on to the next module, the multiplier module.
If, e.g., the pre-divider value is set to 2, only every other input signal is passed out unchanged to the multiplier module and, accordingly, the frequency is halved. If the pre-divider value is set to 1, every input signal is passed out unchanged to the multiplier module.
Info
- Employing the pre-divider can be advisable for decreasing periodic jitter of the input signals.
- Basler recommends using low values for the pre-divider. The original signal frequency should be changed as little as possible to facilitate frequency adjustment by the multiplier module.
Multiplier Module#
The multiplier module receives the signals from the pre-divider module. To ensure proper operation, the signal frequency received must not be less than 10 Hz. The multiplier module allows you to apply an integer factor, the multiplier, to generate signals at increased frequencies and passes the signals on to the next module, the post-divider module.
For each input signal, a synchronous output signal is generated, i.e., the signals are in phase. Applying a multiplier factor of three would look like this:
Info
After changing the input signal or the multiplier value, it may take some time to reach such an ideal state of phase alignment as shown above. If input periods vary constantly, e.g., when signals sent by an incremental encoder have substantial jitter, a stable phase alignment might never be reached. However, the output signal will be close to optimum.
Post-Divider Module#
The post-divider module receives the signals from the multiplier module. The post-divider module allows you to apply an integer factor, the post-divider, to generate signals at decreased frequencies and provides these signals to be used as camera trigger signals, e.g. as line start triggers.
Frequency Converter Source Signals#
You can set the source signal of the frequency converter using the BslFrequencyConverterSignalSource
parameter. This defines how the frequency converter is driven. For example, you can specify that the converter is driven by an electrical signal or by a timer signal.
Info
The frequency converter can only process pulsed signals. When choosing a level signal, e.g., Line1
, you must therefore also specify the signal transition that activates the frequency converter.
The following source signals are available:
Encoder1
: The frequency converter can be driven by an incremental encoder.Line1
toLine6
: The frequency converter can be driven by applying an electrical signal to I/O line 1, 2, 3, 4, 5, or 6.CxpTrigger0
,CxpTrigger1
: The frequency converter can be driven by a CXP trigger signal sent from the frame grabber.Counter1Active
toCounter4Active
: The frequency converter can be driven using the Counter feature. The signal will be high (1) as long as the given counter is counting and low (0) as long as it is not counting.Counter1Start
toCounter4Start
: The frequency converter can be driven using the Counter feature. A signal is sent whenever the given counter starts counting.Counter1End
toCounter4End
: The frequency converter can be driven using the Counter feature. A signal is sent whenever the given counter stops counting.Timer1Active
,Timer2Active
: The frequency converter can be driven using the Timer feature. The signal will be high (1) as long as the given timer is running and low (0) as long as it is not running.Timer1End
,Timer2End
: The frequency converter can be driven using the Timer feature. A signal is sent whenever the given timer has elapsed.
Frequency Converter Activation#
The BslFrequencyConverterActivation
parameter allows you to define which signal transition activates the frequency converter. For example, you can specify that the converter becomes active when the trigger signal falls.
Info
The BslFrequencyConverterActivation
parameter is only available when choosing a level signal as the source signal, i.e., a signal that can be high (1) or low (0) such as an I/O signal or an "Active" signal like Timer1Active
.
You can set the BslFrequencyConverterActivation
parameter to one of the following values:
RisingEdge
: The frequency converter becomes active when the trigger signal rises, i.e., when the signal status changes from low to high. This is the default setting.FallingEdge
: The frequency converter becomes active when the trigger signal falls, i.e., when the signal status changes from high to low.AnyEdge
: The frequency converter becomes active when the trigger signal falls or rises.
Configuring the Frequency Converter#
To configure the frequency converter:
- Set the
BslFrequencyConverterSignalSource
parameter to one of the available source signals, e.g.,Encoder1
. - If you have selected a level signal as source signal, set the
BslFrequencyConverterActivation
parameter, e.g., toRisingEdge
. - Set the
BslFrequencyConverterPreDivider
parameter, e.g., to 3. - Set the
BslFrequencyConverterMultiplier
parameter, e.g., to 4. - Set the
BslFrequencyConverterPostDivider
parameter, e.g., to 2.
Sample Code#
// Select encoder 1 as the source signal for the frequency converter
camera.BslFrequencyConverterSignalSource.SetValue(BslFrequencyConverterSignalSource_Encoder1);
// Set the pre-divider value to 3
camera.BslFrequencyConverterPreDivider.SetValue(3);
// Set the multiplier value to 4
camera.BslFrequencyConverterMultiplier.SetValue(4);
// Set the post-divider to 2
camera.BslFrequencyConverterPostDivider.SetValue(2);
INodeMap& nodemap = camera.GetNodeMap();
// Select encoder 1 as the source signal for the frequency converter
CEnumParameter(nodemap, "BslFrequencyConverterSignalSource").SetValue("Encoder1");
// Set the pre-divider value to 3
CIntegerParameter(nodemap, "BslFrequencyConverterPreDivider").SetValue(3);
// Set the multiplier value to 4
CIntegerParameter(nodemap, "BslFrequencyConverterMultiplier").SetValue(4);
// Set the post-divider to 2
CIntegerParameter(nodemap, "BslFrequencyConverterPostDivider").SetValue(2);
// Select encoder 1 as the source signal for the frequency converter
camera.Parameters[PLCamera.BslFrequencyConverterSignalSource].SetValue(PLCamera.BslFrequencyConverterSignalSource.Encoder1);
// Set the pre-divider value to 3
camera.Parameters[PLCamera.BslFrequencyConverterPreDivider].SetValue(3);
// Set the multiplier value to 4
camera.Parameters[PLCamera.BslFrequencyConverterMultiplier].SetValue(4);
// Set the post-divider to 2
camera.Parameters[PLCamera.BslFrequencyConverterPostDivider].SetValue(2);
/* 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 encoder 1 as the source signal for the frequency converter */
errRes = PylonDeviceFeatureFromString(hdev, "BslFrequencyConverterSignalSource", "Encoder1");
CHECK(errRes);
/* Set the pre-divider value to 3 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslFrequencyConverterPreDivider", 3);
CHECK(errRes);
/* Set the multiplier value to 4 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslFrequencyConverterMultiplier", 4);
CHECK(errRes);
/* Set the post-divider to 2 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslFrequencyConverterPostDivider", 2);
CHECK(errRes);
# Select encoder 1 as the source signal for the frequency converter
camera.BslFrequencyConverterSignalSource.Value = "Encoder1"
# Set the pre-divider value to 3
camera.BslFrequencyConverterPreDivider.Value = 3
# Set the multiplier value to 4
camera.BslFrequencyConverterMultiplier.Value = 4
# Set the post-divider to 2
camera.BslFrequencyConverterPostDivider.Value = 2
You can also use the pylon Viewer to easily set the parameters.