Chapter 4
General-Purpose Counter/Timer
DAQ-STC Technical Reference Manual
4-6
©
National Instruments Corporation
4.4.1.5 Relative Position Sensing
In relative position sensing, the counter tracks the relative position of an object. Two types
of events are possible—movement in the positive direction and movement in the negative
direction. The positive movement event is an active edge transition on the G_SOURCE input
while G_UP_DOWN is high. The negative movement event is an active edge transition on the
G_SOURCE input while G_UP_DOWN is low. The software initially loads the counter with
a value corresponding to the initial position of the object. Positive movement events cause the
counter to increment and negative movement events cause the counter to decrement. Upon
reaching TC, the counter rolls over. The user can obtain the relative position of the object at
any time by asynchronously reading the counter value. Figure 4-6 shows an example of
relative position sensing.
Figure 4-6.
Relative Position Sensing
4.4.2 Time Measurement
In the time-measurement functions, the counter uses G_SOURCE as a timebase to measure
the time interval between events on the G_GATE signal. The following actions are available
in time measurement:
•
Rising edges on G_SOURCE can increment or decrement the counter during the
measurement interval.
•
Counting can begin and end on any two of the G_GATE edges—active, inactive, or
either.
•
The HW save register can save the counter value upon the completion of the
measurement.
4.4.2.1 Single-Period Measurement
In single-period measurement, the counter uses G_SOURCE to measure the period of the
signal present on the G_GATE input. The counter counts the number of rising edges that
occur on G_SOURCE between two active edges of G_GATE. At the completion of the period
interval for G_GATE, the HW save register latches the counter value for software read.
Software Arm
G_SOURCE
G_UP_DOWN
Counter Value
1
0
3
4
4
3
2
3
2