Sequencer (ace Classic/U/L USB)#
您可以定义多达 32 组参数设置(称为定序器集)。相机采集图像时,会逐个应用定序器集。这使您可以快速更改相机参数,而不会影响最大帧速率。
例如,您可以使用 Sequencer 功能,在预配置的图像 ROI或曝光时间之间快速切换。
该功能的使用#
定序器模式#
- 在定序器模式下,定序器控制图像采集。无法在此状态下配置定序器。
- 在定序器配置模式下,可以配置定序器,但定序器不控制图像采集。
要启用定序器模式:
- Set all auto functions (e.g., Gain Auto, Exposure Auto) to
熄灭
. - 设置
SequencerMode
parameter to在
.
要启用定序器配置模式:
- 设置
SequencerMode
parameter to熄灭
. - 设置
SequencerConfigurationMode
parameter to在
.
信息
在 acA1920-25uc/um 和 acA2500-14uc/um 相机上,使用不同的定序器集获取图像时,无法进行重叠图像采集。在加载新的序列集之前,相机必须完成整个曝光和读出过程。因此,可以显著降低帧速率。
定序器集中包含什么?#
定序器集包含以下参数(如果可用):
AcquisitionFrameRate
AcquisitionFrameRateEnable
BalanceRatio
BinningHorizontal
BinningVertical
BlackLevel
CenterX
CenterY
ChunkEnable
ChunkModeActive
ColorAdjustmentHue
ColorAdjustmentSaturation
ColorTransformationValue
CounterDuration
(for Counter 2)CounterEventSource
CounterResetSource
DigitalShift
ExposureTime
Gain
Height
LUTEnable
aOffsetX
OffsetY
PixelFormat
bReverseX
ReverseY
cScalingHorizontal
SequencerSetNext
SequencerSetPath
SequencerSetSelector
SequencerSetStart
SequencerTriggerActivation
SequencerTriggerSource
TestImageSelector
TimerDelay
(for Timer 1)TimerDuration
(for Timer 1)Width
其他所有相机参数均无法使用 Sequencer 功能控制。
-
Only contained if the
Gamma
parameter is set to 1.0 and theLightSourcePreset
parameter is set to熄灭
. -
仅适用于以下相机型号:acA640-750um/uc、acA800-510um/uc、acA1300-200um/uc、acA1920-150um/uc、acA2500-60um/uc。
-
不适用于以下相机型号:acA3088-57um/uc、acA4024-29um/uc、acA5472-17um/uc。
信息
加载或保存定序器集将始终加载或保存以上所有参数,包括您未更改的参数在内。例如,如果仅更改 Exposure Time 并保留所有其他参数的默认值,则所有其他参数的值也将被存储,并在加载时被覆盖。
配置定序器集#
信息
在使用 Sequencer 功能之前,必须使用所需的设置填充定序器集。每个定序器集都有一个唯一的定序器集索引编号,范围从 0 到 31。
要填充定序器集:
示例:假设您需要两个定序器集,并希望使用不同的图像 ROI 设置来填充。为此:
- Create the first image ROI by adjusting the
Width
,Height
,OffsetX
, andOffsetY
parameter values. - 保存定序器集 0。
- Create the second image ROI by choosing different values for the
Width
,Height
,OffsetX
, andOffsetY
parameters. - 保存定序器集 1。
现在,您可以将定序器配置为在两个图像 ROI 之间快速切换。
保存定序器集#
要保存定序器集:
- 设置
SequencerSetSelector
parameter to the desired sequencer set. - Execute the
SequencerSetSave
command.
所有定序器集参数的值都存储在选定的定序器集中。
加载定序器集#
定序器集在定序器操作期间自动加载。但是,手动加载定序器集对于测试或定序器的配置可能很有用。
若要手动加载定序器集:
- 设置
SequencerSetSelector
parameter to the desired sequencer set. - Execute the
SequencerSetLoad
command.
所有定序器集参数的值都将被覆盖,并由存储在所选定序器集中的值替换。
配置 Sequencer#
配置定序器集后,必须设置定序器。
信息
- 定序器必须处于配置模式,才能进行配置。
- 断开相机电源后,对定序器配置所做的所有更改都将丢失。另外,定序器集也无法保存在用户设置集中。Basler 建议您使用 pylon API 编写适当的程序代码,在相机每次开启电源时重新配置相机。
- 您可以使用 SequencerSetActive块 来跟踪所使用的定序器集。启用后,每个图像都包含块数据,该数据包括用于图像采集的定序器集的索引号。
路径 0 和路径 1#
要控制定序器,必须设置两个“路径”:
-
路径 1 允许您循环遍历可用的定序器集(定序器集推进)。每当定序器接收到“路径 1”触发信号时,定序器就会推进到下一个设置。示例:
-
路径 0 允许您重置循环(定序器集重置)。每当定序器收到“路径 0”触发信号时,定序器就会从定序器集 0 重新开始循环。示例:
设置路径 0#
要设置路径 0,您必须指定要用作“路径 0”触发信号(即用作定序器集重置信号)的源信号。
您可以选择硬件信号或软件信号作为路径 0 的源信号。源设置必须存储在定序器集 0 中。
要指定路径 0 的源信号:
- 加载定序器集 0。
- 设置
SequencerPathSelector
parameter to 0. - 设置
SequencerTriggerSource
参数设置为以下值:Line1
,Line3
, orLine4
: Sequencer set reset can be controlled via input line 1, GPIO line 3, or GPIO line 4.SoftwareSignal1
,SoftwareSignal2
, orSoftwareSignal3
: Sequencer set reset can be controlled using the Software Signal Pulse feature.
- 保存定序器集 0。
信息
- 对于实时应用,Basler 强烈建议不要通过软件命令控制定序器集重置。由于信号处理和传输,在发出软件命令与定序器集重置之间的延迟不确定。因此,无法预测在发送软件命令到命令生效之间可能发生的图像采集次数。
- 路径 0 和路径 1 不得使用相同的触发源。
设置路径 1#
指定触发源#
首先,您必须指定要用作“路径 1”触发信号(即用作定序器集推进信号)的源信号。
您可以选择帧开始触发信号、硬件信号、软件信号或计数器作为路径 1 的源信号。源设置必须存储在定序器集 0 中。
要指定路径 1 的源信号:
- 加载定序器集 0。
- 设置
SequencerPathSelector
parameter to 1. - 设置
SequencerTriggerSource
参数设置为以下值:FrameStart
: Sequencer set advance occurs automatically as Frame Start trigger signals are received.Line1
,Line3
, orLine4
: Sequencer set advance can be controlled via input line 1, GPIO line 3, or GPIO line 4. To use one of the GPIO lines, the line must be configured for input. If the specified line is low (0) while a frame start trigger signal is received, the sequencer does not advance, and the current set is used again for image acquisition. If the line is high (1) while a Frame Start trigger signal is received, the sequencer advances, and the next sequencer set in the cycle is used for image acquisition.SoftwareSignal1
,SoftwareSignal2
, orSoftwareSignal3
: Sequencer set advance can be controlled using the Software Signal Pulse feature.Counter2End
: Sequencer set advance can be controlled using a counter.
- 保存定序器集 0。
指定使用的定序器集#
其次,您必须指定在定序器操作期间要使用哪些定序器集。
默认情况下,将使用全部 32 个定序器集。当接收到“路径 1”触发信号时,定序器会将定序器集的索引号从 0 一直推进至 31。在此之后,循环从 0 重新开始。
要使用编号较小的定序器集:
-
加载定序器集以及您要使用的最高索引号。
示例:假设您已配置 5 个定序器集,并且想要设置以下循环:In this cycle, the highest sequencer set index number is 4. Therefore, load sequencer set 4. 2. Set the
SequencerPathSelector
parameter to 1. 3. Set theSequencerSetNext
parameter to 0. 4. Save the sequencer set.
在运行期间,定序器将在索引号最高的设置之后切换到定序器集 0。从而形成闭环循环。
信息
- 对于实时应用,Basler 强烈建议不要通过软件命令控制定序器集推进。由于信号处理和传输,在发出软件命令与定序器集推进之间的延迟不确定。因此,无法预测在发送软件命令到命令生效之间可能发生的图像采集次数。
- 路径 0 和路径 1 不得使用相同的触发源。
使用计数器控制定序器#
If you set the source signal for path 1 to Counter2End
, you can use a counter to control sequencer set advance.
如果要设置一个固定序列,该序列连续多次使用定序器集,则此功能很有用。
For each sequencer set, you can set the CounterDuration
parameter to specify how many times the set is to be used in a row. By default, the parameter is set to 1 for all sets, and each sequence set is used once per cycle.
示例:假设您要设置以下定序器集循环:
要设置上述定序器集循环:
- 加载定序器集 0。
- 设置
SequencerPathSelector
parameter to 1. - 设置
SequencerTriggerSource
parameter toCounter2End
. - 保存定序器集 0。
- 设置
CounterSelector
parameter toCounter2
. -
设置
CounterDuration
parameter for each sequencer set:- Sequencer sets 0, 2, 3, and 4 are to be used only once per cycle. Therefore, you can skip these sets and leave the
CounterDuration
parameter at the default value of 1. - Sequencer set 1 is to be used three times in a row. Load sequencer set 1, set the
CounterDuration
parameter to 3, and save sequencer set 1. - Sequencer set 5 is to be used two times in a row. Load sequencer set 5, set the
CounterDuration
parameter to 2, and save sequencer set 5.
- Sequencer sets 0, 2, 3, and 4 are to be used only once per cycle. Therefore, you can skip these sets and leave the
附加参数#
即: SequencerSetStart
and SequencerTriggerActivation
parameters also control the operation of the sequencer. However, these parameters are preset and can't be changed.
示例代码#
// ** Configuring the sequencer sets **
// Enable sequencer configuration mode
camera.SequencerMode.SetValue(SequencerMode_Off);
camera.SequencerConfigurationMode.SetValue(SequencerConfigurationMode_On);
// Configure parameters to be stored in the first sequencer set
camera.Width.SetValue(600);
camera.Height.SetValue(300);
// Select sequencer set 0 and save the parameter values
camera.SequencerSetSelector.SetValue(0);
camera.SequencerSetSave.Execute();
// Configure parameters to be stored in the second sequencer set
camera.Width.SetValue(800);
camera.Height.SetValue(600);
// Select sequencer set 1 and save the parameter values
camera.SequencerSetSelector.SetValue(1);
camera.SequencerSetSave.Execute();
// Enable sequencer mode to operate the sequencer
camera.SequencerMode.SetValue(SequencerMode_On);
// ** Setting up path 0 **
// Enable sequencer configuration mode
camera.SequencerMode.SetValue(SequencerMode_Off);
camera.SequencerConfigurationMode.SetValue(SequencerConfigurationMode_On);
// Load sequencer set 0 and select path 0
camera.SequencerSetSelector.SetValue(0);
camera.SequencerSetLoad.Execute();
camera.SequencerPathSelector.SetValue(0);
// Set software signal 1 as "path 0" trigger signal
camera.SequencerTriggerSource.SetValue(SequencerTriggerSource_SoftwareSignal1);
// Save the changes
camera.SequencerSetSave.Execute();
// Enable sequencer mode to operate the sequencer
camera.SequencerMode.SetValue(SequencerMode_On);
// * Setting up path 1 **
// Enable sequencer configuration mode
camera.SequencerMode.SetValue(SequencerMode_Off);
camera.SequencerConfigurationMode.SetValue(SequencerConfigurationMode_On);
// Load sequencer set 0 and select path 1
camera.SequencerSetSelector.SetValue(0);
camera.SequencerSetLoad.Execute();
camera.SequencerPathSelector.SetValue(1);
// Set software signal 2 as "path 1" trigger signal
camera.SequencerTriggerSource.SetValue(SequencerTriggerSource_SoftwareSignal2);
// Save the changes
camera.SequencerSetSave.Execute();
// Assume you want to set up the following sequencer set cycle:
// 0 - 1 - 2 - 3 (- 0 - 1 - ...)
// Load the sequencer set with the highest index number to be used (here: 3)
camera.SequencerSetSelector.SetValue(3);
camera.SequencerSetLoad.Execute();
// Set the next sequencer set to 0 to "close the circle"
camera.SequencerPathSelector.SetValue(1);
camera.SequencerSetNext.SetValue(0);
// Save the changes
camera.SequencerSetSave.Execute();
// Enable sequencer mode to operate the sequencer
camera.SequencerMode.SetValue(SequencerMode_On);
// ** Advanced: Using a counter to control the sequencer **
// Enable sequencer configuration mode
camera.SequencerMode.SetValue(SequencerMode_Off);
camera.SequencerConfigurationMode.SetValue(SequencerConfigurationMode_On);
// Load sequencer set 0 and select path 1
camera.SequencerSetSelector.SetValue(0);
camera.SequencerSetLoad.Execute();
camera.SequencerPathSelector.SetValue(1);
// Set the Counter2 end event as "path 1" trigger signal
camera.SequencerTriggerSource.SetValue(SequencerTriggerSource_Counter2End);
// Save the changes
camera.SequencerSetSave.Execute();
// Select counter 2 to configure this counter
camera.CounterSelector.SetValue(CounterSelector_Counter2);
// Assume you want to set up the following sequencer set cycle:
// 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...)
// Load sequencer set 0 and specify that this set is to be used
// two times in a row
camera.SequencerSetSelector.SetValue(0);
camera.SequencerSetLoad.Execute();
camera.CounterDuration.SetValue(2);
camera.SequencerSetSave.Execute();
// Load sequencer set 1 and specify that this set is to be used
// three times in a row
camera.SequencerSetSelector.SetValue(1);
camera.SequencerSetLoad.Execute();
camera.CounterDuration.SetValue(3);
camera.SequencerSetSave.Execute();
// Enable sequencer mode to operate the sequencer
camera.SequencerMode.SetValue(SequencerMode_On);
INodeMap& nodemap = camera.GetNodeMap();
// ** Configuring the sequencer sets **
// Enable sequencer configuration mode
CEnumParameter(nodemap, "SequencerMode").SetValue("Off");
CEnumParameter(nodemap, "SequencerConfigurationMode").SetValue("On");
// Configure parameters to be stored in the first sequencer set
CIntegerParameter(nodemap, "Width").SetValue(600);
CIntegerParameter(nodemap, "Height").SetValue(300);
// Select sequencer set 0 and save the parameter values
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(0);
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Configure parameters to be stored in the second sequencer set
CIntegerParameter(nodemap, "Width").SetValue(800);
CIntegerParameter(nodemap, "Height").SetValue(600);
// Select sequencer set 1 and save the parameter values
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(1);
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Enable sequencer mode to operate the sequencer
CEnumParameter(nodemap, "SequencerMode").SetValue("On");
// ** Setting up path 0 **
// Enable sequencer configuration mode
CEnumParameter(nodemap, "SequencerMode").SetValue("Off");
CEnumParameter(nodemap, "SequencerConfigurationMode").SetValue("On");
// Load sequencer set 0 and select path 0
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(0);
CCommandParameter(nodemap, "SequencerSetLoad").Execute();
CIntegerParameter(nodemap, "SequencerPathSelector").SetValue(0);
// Set software signal 1 as "path 0" trigger signal
CEnumParameter(nodemap, "SequencerTriggerSource").SetValue("SoftwareSignal1");
// Save the changes
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Enable sequencer mode to operate the sequencer
CEnumParameter(nodemap, "SequencerMode").SetValue("On");
// * Setting up path 1 **
// Enable sequencer configuration mode
CEnumParameter(nodemap, "SequencerMode").SetValue("Off");
CEnumParameter(nodemap, "SequencerConfigurationMode").SetValue("On");
// Load sequencer set 0 and select path 1
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(0);
CCommandParameter(nodemap, "SequencerSetLoad").Execute();
CIntegerParameter(nodemap, "SequencerPathSelector").SetValue(1);
// Set software signal 2 as "path 1" trigger signal
CEnumParameter(nodemap, "SequencerTriggerSource").SetValue("SoftwareSignal2");
// Save the changes
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Assume you want to set up the following sequencer set cycle:
// 0 - 1 - 2 - 3 (- 0 - 1 - ...)
// Load the sequencer set with the highest index number to be used (here: 3)
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(3);
CCommandParameter(nodemap, "SequencerSetLoad").Execute();
// Set the next sequencer set to 0 to "close the circle"
CIntegerParameter(nodemap, "SequencerPathSelector").SetValue(1);
CIntegerParameter(nodemap, "SequencerSetNext").SetValue(0);
// Save the changes
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Enable sequencer mode to operate the sequencer
CEnumParameter(nodemap, "SequencerMode").SetValue("On");
// ** Advanced: Using a counter to control the sequencer **
// Enable sequencer configuration mode
CEnumParameter(nodemap, "SequencerMode").SetValue("Off");
CEnumParameter(nodemap, "SequencerConfigurationMode").SetValue("On");
// Load sequencer set 0 and select path 1
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(0);
CCommandParameter(nodemap, "SequencerSetLoad").Execute();
CIntegerParameter(nodemap, "SequencerPathSelector").SetValue(1);
// Set the Counter2 end event as "path 1" trigger signal
CEnumParameter(nodemap, "SequencerTriggerSource").SetValue("Counter2End");
// Save the changes
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Select counter 2 to configure this counter
CEnumParameter(nodemap, "CounterSelector").SetValue("Counter2");
// Assume you want to set up the following sequencer set cycle:
// 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...)
// Load sequencer set 0 and specify that this set is to be used
// two times in a row
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(0);
CCommandParameter(nodemap, "SequencerSetLoad").Execute();
CIntegerParameter(nodemap, "CounterDuration").SetValue(2);
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Load sequencer set 1 and specify that this set is to be used
// three times in a row
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(1);
CCommandParameter(nodemap, "SequencerSetLoad").Execute();
CIntegerParameter(nodemap, "CounterDuration").SetValue(3);
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Enable sequencer mode to operate the sequencer
CEnumParameter(nodemap, "SequencerMode").SetValue("On");
// ** Configuring the sequencer sets **
// Enable sequencer configuration mode
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.Off);
camera.Parameters[PLCamera.SequencerConfigurationMode].SetValue(PLCamera.SequencerConfigurationMode.On);
// Configure parameters to be stored in the first sequencer set
camera.Parameters[PLCamera.Width].SetValue(600);
camera.Parameters[PLCamera.Height].SetValue(300);
// Select sequencer set 0 and save the parameter values
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(0);
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Configure parameters to be stored in the second sequencer set
camera.Parameters[PLCamera.Width].SetValue(800);
camera.Parameters[PLCamera.Height].SetValue(600);
// Select sequencer set 1 and save the parameter values
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(1);
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Enable sequencer mode to operate the sequencer
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.On);
// ** Setting up path 0 **
// Enable sequencer configuration mode
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.Off);
camera.Parameters[PLCamera.SequencerConfigurationMode].SetValue(PLCamera.SequencerConfigurationMode.On);
// Load sequencer set 0 and select path 0
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(0);
camera.Parameters[PLCamera.SequencerSetLoad].Execute();
camera.Parameters[PLCamera.SequencerPathSelector].SetValue(0);
// Set software signal 1 as "path 0" trigger signal
camera.Parameters[PLCamera.SequencerTriggerSource].SetValue(PLCamera.SequencerTriggerSource.SoftwareSignal1);
// Save the changes
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Enable sequencer mode to operate the sequencer
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.On);
// * Setting up path 1 **
// Enable sequencer configuration mode
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.Off);
camera.Parameters[PLCamera.SequencerConfigurationMode].SetValue(PLCamera.SequencerConfigurationMode.On);
// Load sequencer set 0 and select path 1
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(0);
camera.Parameters[PLCamera.SequencerSetLoad].Execute();
camera.Parameters[PLCamera.SequencerPathSelector].SetValue(1);
// Set software signal 2 as "path 1" trigger signal
camera.Parameters[PLCamera.SequencerTriggerSource].SetValue(PLCamera.SequencerTriggerSource.SoftwareSignal2);
// Save the changes
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Assume you want to set up the following sequencer set cycle:
// 0 - 1 - 2 - 3 (- 0 - 1 - ...)
// Load the sequencer set with the highest index number to be used (here: 3)
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(3);
camera.Parameters[PLCamera.SequencerSetLoad].Execute();
// Set the next sequencer set to 0 to "close the circle"
camera.Parameters[PLCamera.SequencerPathSelector].SetValue(1);
camera.Parameters[PLCamera.SequencerSetNext].SetValue(0);
// Save the changes
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Enable sequencer mode to operate the sequencer
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.On);
// ** Advanced: Using a counter to control the sequencer **
// Enable sequencer configuration mode
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.Off);
camera.Parameters[PLCamera.SequencerConfigurationMode].SetValue(PLCamera.SequencerConfigurationMode.On);
// Load sequencer set 0 and select path 1
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(0);
camera.Parameters[PLCamera.SequencerSetLoad].Execute();
camera.Parameters[PLCamera.SequencerPathSelector].SetValue(1);
// Set the Counter2 end event as "path 1" trigger signal
camera.Parameters[PLCamera.SequencerTriggerSource].SetValue(PLCamera.SequencerTriggerSource.Counter2End);
// Save the changes
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Select counter 2 to configure this counter
camera.Parameters[PLCamera.CounterSelector].SetValue(PLCamera.CounterSelector.Counter2);
// Assume you want to set up the following sequencer set cycle:
// 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...)
// Load sequencer set 0 and specify that this set is to be used
// two times in a row
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(0);
camera.Parameters[PLCamera.SequencerSetLoad].Execute();
camera.Parameters[PLCamera.CounterDuration].SetValue(2);
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Load sequencer set 1 and specify that this set is to be used
// three times in a row
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(1);
camera.Parameters[PLCamera.SequencerSetLoad].Execute();
camera.Parameters[PLCamera.CounterDuration].SetValue(3);
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Enable sequencer mode to operate the sequencer
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.On);
/* 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 */
/* ** Configuring the sequencer sets ** */
/* Enable sequencer configuration mode */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "Off");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerConfigurationMode", "On");
CHECK(errRes);
/* Configure parameters to be stored in the first sequencer set */
errRes = PylonDeviceSetIntegerFeature(hdev, "Width", 600);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "Height", 300);
CHECK(errRes);
/* Select sequencer set 0 and save the parameter values */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 0);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Configure parameters to be stored in the second sequencer set */
errRes = PylonDeviceSetIntegerFeature(hdev, "Width", 800);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "Height", 600);
CHECK(errRes);
/* Select sequencer set 1 and save the parameter values */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 1);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Enable sequencer mode to operate the sequencer */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "On");
CHECK(errRes);
/* ** Setting up path 0 ** */
/* Enable sequencer configuration mode */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "Off");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerConfigurationMode", "On");
CHECK(errRes);
/* Load sequencer set 0 and select path 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 0);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetLoad");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerPathSelector", 0);
CHECK(errRes);
/* Set software signal 1 as "path 0" trigger signal */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerTriggerSource", "SoftwareSignal1");
CHECK(errRes);
/* Save the changes */
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Enable sequencer mode to operate the sequencer */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "On");
CHECK(errRes);
/* * Setting up path 1 ** */
/* Enable sequencer configuration mode */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "Off");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerConfigurationMode", "On");
CHECK(errRes);
/* Load sequencer set 0 and select path 1 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 0);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetLoad");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerPathSelector", 1);
CHECK(errRes);
/* Set software signal 2 as "path 1" trigger signal */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerTriggerSource", "SoftwareSignal2");
CHECK(errRes);
/* Save the changes */
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Assume you want to set up the following sequencer set cycle: */
/* 0 - 1 - 2 - 3 (- 0 - 1 - ...) */
/* Load the sequencer set with the highest index number to be used (here: 3) */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 3);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetLoad");
CHECK(errRes);
/* Set the next sequencer set to 0 to "close the circle" */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerPathSelector", 1);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetNext", 0);
CHECK(errRes);
/* Save the changes */
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Enable sequencer mode to operate the sequencer */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "On");
CHECK(errRes);
/* ** Advanced: Using a counter to control the sequencer ** */
/* Enable sequencer configuration mode */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "Off");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerConfigurationMode", "On");
CHECK(errRes);
/* Load sequencer set 0 and select path 1 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 0);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetLoad");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerPathSelector", 1);
CHECK(errRes);
/* Set the Counter2 end event as "path 1" trigger signal */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerTriggerSource", "Counter2End");
CHECK(errRes);
/* Save the changes */
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Select counter 2 to configure this counter */
errRes = PylonDeviceFeatureFromString(hdev, "CounterSelector", "Counter2");
CHECK(errRes);
/* Assume you want to set up the following sequencer set cycle: */
/* 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...) */
/* Load sequencer set 0 and specify that this set is to be used */
/* two times in a row */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 0);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetLoad");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "CounterDuration", 2);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Load sequencer set 1 and specify that this set is to be used */
/* three times in a row */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 1);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetLoad");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "CounterDuration", 3);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Enable sequencer mode to operate the sequencer */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "On");
CHECK(errRes);
# ** Configuring the sequencer sets **
# Enable sequencer configuration mode
camera.SequencerMode.Value = "Off"
camera.SequencerConfigurationMode.Value = "On"
# Configure parameters to be stored in the first sequencer set
camera.Width.Value = 600
camera.Height.Value = 300
# Select sequencer set 0 and save the parameter values
camera.SequencerSetSelector.Value = 0
camera.SequencerSetSave.Execute()
# Configure parameters to be stored in the second sequencer set
camera.Width.Value = 800
camera.Height.Value = 600
# Select sequencer set 1 and save the parameter values
camera.SequencerSetSelector.Value = 1
camera.SequencerSetSave.Execute()
# Enable sequencer mode to operate the sequencer
camera.SequencerMode.Value = "On"
# ** Setting up path 0 **
# Enable sequencer configuration mode
camera.SequencerMode.Value = "Off"
camera.SequencerConfigurationMode.Value = "On"
# Load sequencer set 0 and select path 0
camera.SequencerSetSelector.Value = 0
camera.SequencerSetLoad.Execute()
camera.SequencerPathSelector.Value = 0
# Set software signal 1 as "path 0" trigger signal
camera.SequencerTriggerSource.Value = "SoftwareSignal1"
# Save the changes
camera.SequencerSetSave.Execute()
# Enable sequencer mode to operate the sequencer
camera.SequencerMode.Value = "On"
# * Setting up path 1 **
# Enable sequencer configuration mode
camera.SequencerMode.Value = "Off"
camera.SequencerConfigurationMode.Value = "On"
# Load sequencer set 0 and select path 1
camera.SequencerSetSelector.Value = 0
camera.SequencerSetLoad.Execute()
camera.SequencerPathSelector.Value = 1
# Set software signal 2 as "path 1" trigger signal
camera.SequencerTriggerSource.Value = "SoftwareSignal2"
# Save the changes
camera.SequencerSetSave.Execute()
# Assume you want to set up the following sequencer set cycle:
# 0 - 1 - 2 - 3 (- 0 - 1 - ...)
# Load the sequencer set with the highest index number to be used (here: 3)
camera.SequencerSetSelector.Value = 3
camera.SequencerSetLoad.Execute()
# Set the next sequencer set to 0 to "close the circle"
camera.SequencerPathSelector.Value = 1
camera.SequencerSetNext.Value = 0
# Save the changes
camera.SequencerSetSave.Execute()
# Enable sequencer mode to operate the sequencer
camera.SequencerMode.Value = "On"
# ** Advanced: Using a counter to control the sequencer **
# Enable sequencer configuration mode
camera.SequencerMode.Value = "Off"
camera.SequencerConfigurationMode.Value = "On"
# Load sequencer set 0 and select path 1
camera.SequencerSetSelector.Value = 0
camera.SequencerSetLoad.Execute()
camera.SequencerPathSelector.Value = 1
# Set the Counter2 end event as "path 1" trigger signal
camera.SequencerTriggerSource.Value = "Counter2End"
# Save the changes
camera.SequencerSetSave.Execute()
# Select counter 2 to configure this counter
camera.CounterSelector.Value = "Counter2"
# Assume you want to set up the following sequencer set cycle:
# 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...)
# Load sequencer set 0 and specify that this set is to be used
# two times in a row
camera.SequencerSetSelector.Value = 0
camera.SequencerSetLoad.Execute()
camera.CounterDuration.Value = 2
camera.SequencerSetSave.Execute()
# Load sequencer set 1 and specify that this set is to be used
# three times in a row
camera.SequencerSetSelector.Value = 1
camera.SequencerSetLoad.Execute()
camera.CounterDuration.Value = 3
camera.SequencerSetSave.Execute()
# Enable sequencer mode to operate the sequencer
camera.SequencerMode.Value = "On"
您也可以使用 pylon Viewer 轻松设置参数。