Counter (ace)

The Counter camera feature allows you to count certain camera events, e.g., the number of images acquired.

For a description of the Counter feature for ace 2 and boost cameras, click here.

In this topic Hide

Using the Feature

How It Works

Two counters are available: Counter 1 and Counter 2.

With one exception (see below), every counter has the following characteristics:

Exception: On some camera models, Counter 2 can be used to control the sequencer. This counter has different characteristics due to its specific purpose.

Getting the Value of a Counter

To determine the current value of a counter, retrieve the related data chunk using the Data Chunks feature.

Resetting a Counter

To reset a counter:

  1. Set the CounterSelector parameter to the desired counter, e.g., Counter2.
  2. Set the CounterResetSource parameter to a software source (Software) or to a hardware source (e.g., Line1).
  3. Depending on the source selected in step 2, do one of the following:
    1. If you set a software source, execute the CounterReset command.
    2. If you set a hardware source, apply an electrical signal to one of the camera's input lines.

Additional Parameters

Specifics

Camera Model Counter Name Function Event Source Related Data Chunk Can Be Reset
All ace 2 GigE camera models

See Counter (ace 2, boost)

- - - -
All ace 2 USB 3.0 camera models

See Counter (ace 2, boost)

- - - -
All ace GigE camera models Counter 1 Counts number of hardware frame start trigger signals received, regardless of whether they cause image acquisitions or not Frame Trigger Trigger Input Counter Chunk Yes
Counter 2 Counts number of acquired images Frame Start Frame Counter Chunk Yes
All ace USB 3.0 camera models Counter 1 Counts number of acquired images Frame Start Counter Value Chunk Yes
Counter 2 Can be used to control the sequencer Frame Start - No
All boost CXP-12 camera models See Counter (ace 2, boost) - - - -
All dart BCON for LVDS camera models Counter feature not supported - - - -
All dart BCON for MIPI cameras models Counter feature not supported - - - -
All dart USB 3.0 camera models Counter feature not supported - - - -
All pulse USB 3.0 camera models Counter feature not supported - - - -

Sample Code

// Reset Counter 1 via software command
camera.CounterSelector.SetValue(CounterSelector_Counter1);
camera.CounterResetSource.SetValue(CounterResetSource_Software);
camera.CounterReset.Execute();
// Get the event source of Counter 1
camera.CounterSelector.SetValue(CounterSelector_Counter1);
CounterEventSourceEnums e = camera.CounterEventSource.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Reset Counter 1 via software command
CEnumerationPtr(nodemap.GetNode("CounterSelector"))->FromString("Counter1");
CEnumerationPtr(nodemap.GetNode("CounterResetSource"))->FromString("Software");
CCommandPtr(nodemap.GetNode("CounterReset"))->Execute();
// Get the event source of Counter 1
CEnumerationPtr(nodemap.GetNode("CounterSelector"))->FromString("Counter1");
String_t e = CEnumerationPtr(nodemap.GetNode("CounterEventSource"))->ToString();
// Reset Counter 1 via software command
camera.Parameters[PLCamera.CounterSelector].SetValue(PLCamera.CounterSelector.Counter1);
camera.Parameters[PLCamera.CounterResetSource].SetValue(PLCamera.CounterResetSource.Software);
camera.Parameters[PLCamera.CounterReset].Execute();
// Get the event source of Counter 1
camera.Parameters[PLCamera.CounterSelector].SetValue(PLCamera.CounterSelector.Counter1);
string e = camera.Parameters[PLCamera.CounterEventSource].GetValue();
// Reset Counter 1 via software command
Pylon.DeviceFeatureFromString(hdev, "CounterSelector", "Counter1");
Pylon.DeviceFeatureFromString(hdev, "CounterResetSource", "Software");
Pylon.DeviceExecuteCommandFeature(hdev, "CounterReset");
// Get the event source of Counter 1
Pylon.DeviceFeatureFromString(hdev, "CounterSelector", "Counter1");
string e = Pylon.DeviceFeatureToString(hdev, "CounterEventSource");
/* 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 e_str[64] = {0};
/* Reset Counter 1 via software command */
errRes = PylonDeviceFeatureFromString(hdev, "CounterSelector", "Counter1");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "CounterResetSource", "Software");
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "CounterReset");
CHECK(errRes);
/* Get the event source of Counter 1 */
errRes = PylonDeviceFeatureFromString(hdev, "CounterSelector", "Counter1");
CHECK(errRes);
len = sizeof(e_str);
errRes = PylonDeviceFeatureToString(hdev, "CounterEventSource", e_str, &len);
CHECK(errRes);

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