Using Counter and Timer Control
Technical Application Note TAN2016004
Revised June 17, 2016
Technical Application Note (TAN2016004): Using Counter and Timer Control
This document provides an overview of the Counter and Timer Control feature in the Blackfly S camera.
The Counter and Timer feature allows you to:
Some general applications include:
Note: This document uses the SpinView application to demonstrate the configuration and execution of Counter and Timer Control.
Possible sources for event, trigger, or reset include:
The counter increments by 1 on every rising edge at Line0 to a maximum of 4.
A = Counter Delay
B = Counter Duration
C = Line0 Input Signal
D = Counter0 Start
E = Counter0 End
Counter status can be queried from the nodemap as either Active or Idle.
The goal of this example is to strobe a 50 Hz pulse with 70% duty cycle.
1. Select a Counter (either 0 or 1).
2. From Counter Event Source, select MHz Tick which is a signal of 1 MHz.
3. To create a 50 Hz clock, we need a counter duration of 20,000.
|1 MHz / 50 Hz =||20,000 cycles / duration|
4. Define Counter Duration and Counter Delay values to create a 70% duty cycle.
|Counter Delay =||30% x 20,000 =||6,000|
|Counter Duration =||70% x 20,000 =||14,000|
5. From Counter Trigger Source, select FrameTriggerWait. Set Counter Trigger Activation to Level High.
6. Disable Exposure Auto and set an Exposure Time of less than 1/50 second.
7. Enable Trigger Mode and select Trigger Source to Counter0 Start.
8. Configure GPIO so that Line 1 is in Output mode and the Line Source is Counter 0 Active.
9. Start streaming.
The goal of this example is to detect missing triggers.
Missing Triggers = Total Number of Triggers – Total Number of Exposures
Counter0 counts the total number of triggers. Counter1 counts the total number of exposures.
1. Disable Exposure Auto and set a long Exposure Time (for example, 3.5 seconds).
2. Enable Trigger Mode and set Trigger Source to line 0 Rising Edge.
3. Connect Line0 (1 Hz TTL signal) to the camera.
4. Configure Counter0 to count the number of triggers.
a. From Counter Event Source, select Line0. Set Counter Event Activation to Rising Edge.
b. From Counter Trigger Source, select Line0. Set Counter Trigger Activation to Rising Edge.
c. Set the Counter Duration to a high value and Counter Delay to 0.
5. Configure Counter1 to count the number of exposures.
a. From Counter Event Source, select ExposureStart. Set Counter Event Activation to Rising Edge.
b. From Counter Trigger Source, select ExposureStart. Set Counter Trigger Activation to Rising Edge.
c. Set the Counter Duration to the same high value as Counter0 and Counter Delay to 0.
6. Enable 1 Hz trigger source. The camera starts capturing images.
7. Right click SpinView GUI to refresh the nodemap and update the Counter Value.
a. Select Counter0 and take note of the Counter Value.
b. Select Counter1 and take note of the Counter Value.
8. Calculate missing triggers:
|Missing trigger =||Counter0 Value – Counter1 Value|
|=||3 – 1|