Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
LabVIEW-Measurements.pdf
Скачиваний:
61
Добавлен:
29.05.2015
Размер:
3.37 Mб
Скачать

Chapter 10 High-Precision Timing (Counters/Timers)

your counting range to over 4 billion. You must also wire the OUT of counter to the SOURCE of counter+1 for this increased counting range.

8253/54

The Count Events (8253) VI, available in the examples\daq\ counter\8253.llb, uses the Intermediate VI, ICTR Control, available on the Functions»Data Acquisition»Counter»Intermediate Counter palette.

This VI initiates the counter to count the number of rising edges of a TTL signal at the CLK of counter. Looking at the block diagram, the first call to ICTR Control loads the count register and sets up counter to count down. The second call to ICTR Control reads the count register. Inside the first While Loop, the count is read until it changes. While the count register has previously been loaded, the new value is not active until the first edge is counted on the CLK pin. Once the first edge comes in, the second While Loop takes over and continually reads the count until you click the STOP button or an error occurs. You must externally wire your signal to be counted to the CLK of counter.

Counting Elapsed Time

How you count elapsed time depends upon which counter chip is on your DAQ device. If you are not sure which chip your DAQ device has, refer to your hardware user manual.

TIO-ASIC, DAQ-STC

Open the Count Time-Easy (DAQ-STC) and Count Edges (NI-TIO) VIs, available in the examples\daq\counter library, and study the block diagrams.

The counter is incremented by every rising edge of its source, typically a known internal timebase, and the elapsed time is calculated by the value of counter times the period of the internal timebase.

Am9513

The Count Time-Easy (9513) VI, available in the examples\daq\ counter\Am9513.llb, uses the Easy VI, Count Events or Time, available on the Functions»Data Acquisition»Counter palette.

This VI initiates the counter to count the number of rising edges of a known internal timebase at the SOURCE of counter. The Count Events or

© National Instruments Corporation

10-33

LabVIEW Measurements Manual

Chapter 10 High-Precision Timing (Counters/Timers)

Time VI takes care of dividing the count by the timebase frequency to determine the elapsed time. The counter continues timing until you click the STOP button. You do not need to make any external connections if the number of counters to use menu is set to one counter (16-bits). If you set the number of counters to use menu to two counters (32-bits), you must externally wire the OUT of counter to the SOURCE of counter+1. The length of time that can be counted depends on the maximum count of the counter(s) and the chosen timebase. For example, the 65,535 (16-bit) count of the Am9513 and a timebase of 1 MHz can count time for 65 ms. Using the 100 Hz timebase and two counters (32-bits), you can count time for over a year.

If you need more control over when your elapsed timing begins and ends, use the Intermediate VIs instead of the Easy VIs. Refer to the Count Time-Int (9513) VI in the examples\daq\counter\Am9513.llb for an example of how to use Intermediate VIs when you need more control over when your elapsed timing begins and ends.

This example uses the Intermediate VIs Event or Time Counter Config, Counter Start, Counter Read, and Counter Stop. The Event or Time Counter Config VI configures counter to count the number of rising edges of a known internal timebase. The Counter Start VI begins the counting operation for counter. The Counter Read VI returns the count until you click the STOP button or an error occurs. The count value is divided by the timebase to determine the elapsed time. Finally, the Counter Stop VI stops the counter operation. You also can gate counter with a pulse to control when it starts and stops timing. To do this, wire your pulse to the GATE of counter, and choose the appropriate gate mode from the front panel menu. Additionally, you can cascade two counters by choosing two counters (32-bits) in the number of counters to use menu. This extends your elapsed time range. You must also wire the OUT of counter to the SOURCE of counter+1 for this increased range.

8253/54

The Count Time (8253) VI, available in the examples\daq\ counter\8253.llb, uses the ICTR Control VI, available on the

Functions»Data Acquisition»Counter»Intermediate Counter palette.

This VI initiates the counter to count the number of rising edges of a

TTL timebase at the CLK of counter. Counter 0 creates the timebase.

Looking at the block diagram, the Timebase Generator (8253) VI sets up

Counter 0 to generate a timebase by dividing down its internal timebase.

The first call to ICTR Control loads the count register and sets up counter

LabVIEW Measurements Manual

10-34

www.ni.com

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]