Chapter 4 General-Purpose Counter/TimerDAQ-STC Technical Reference Manual4-6 ©National Instruments Corporation4.4.1.5 Relative Position SensingIn relative position sensing, the counter tracks the relative position of an object. Two typesof events are possible—movement in the positive direction and movement in the negativedirection. The positive movement event is an active edge transition on the G_SOURCE inputwhile G_UP_DOWN is high. The negative movement event is an active edge transition on theG_SOURCE input while G_UP_DOWN is low. The software initially loads the counter witha value corresponding to the initial position of the object. Positive movement events cause thecounter to increment and negative movement events cause the counter to decrement. Uponreaching TC, the counter rolls over. The user can obtain the relative position of the object atany time by asynchronously reading the counter value. Figure 4-6 shows an example ofrelative position sensing.Figure 4-6. Relative Position Sensing4.4.2 Time MeasurementIn the time-measurement functions, the counter uses G_SOURCE as a timebase to measurethe time interval between events on the G_GATE signal. The following actions are availablein time measurement:• Rising edges on G_SOURCE can increment or decrement the counter during themeasurement interval.• Counting can begin and end on any two of the G_GATE edges—active, inactive, oreither.• The HW save register can save the counter value upon the completion of themeasurement.4.4.2.1 Single-Period MeasurementIn single-period measurement, the counter uses G_SOURCE to measure the period of thesignal present on the G_GATE input. The counter counts the number of rising edges thatoccur on G_SOURCE between two active edges of G_GATE. At the completion of the periodinterval for G_GATE, the HW save register latches the counter value for software read.Software ArmG_SOURCEG_UP_DOWNCounter Value 10 3 443 2 32