Timerio – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 153

Advertising
background image

Section 7. Measurement Instructions

7-27

TimerIO

The TimerIO instruction is used to measure the time between edges (state
transitions) or frequency on the digital I/O ports of the datalogger. The timing
resolution is 50 nanoseconds. The longest interval that can be timed is 214.7
seconds (2

32

x 50 nanoseconds).

Syntax
TimerIO( Dest, Edges, Function, Timeout, Units)

Remarks
There are eight control ports on the datalogger. Six of the ports (1 through 6)
can be used for edge timing and low frequency period/frequency
measurements (<1 kHz). The other two ports (7 and 8) can be used to measure
high frequency signals (up to about 5 MHz) with edge counting only (no edge
timing). When port 7 is enabled, ports 3 and 4 are not available for edge
timing. When port 8 is enabled, ports 5 and 6 cannot be used for edge timing.

The TimerIO instruction has the following parameters:

Parameter
& Data Type

Enter

Dest

The Dest parameter is a variable array in which to store the results of the
measurement. The array must be dimensioned equal to the number of ports for
which results are requested.

Edges

The Edge parameter consists of 8 digits used to configure each of the 8 ports.
The digits represent the ports in descending order from left to right. If a 1 is
entered for a port, the transition will be counted on the rising edge (from <1.5V
to >3.5V). If a 0 is entered, the transition will be counted on the falling edge
(from >3.5V to <1.5V).

Function

The Function parameter has 8 digits. Each digit is used to program the results for
each port. Only one function may be programmed per port. The number of
values returned is determined by the number of ports for which a result is
requested.

Digit

Results

0

The associated port is not used.

1

Calculate the period of the signal on the specified port (in
microseconds).

2

Calculate the frequency (Hz) for the specified port.

3

Calculate the time from an edge on the previous port (1 number
lower) to an edge on the specified port (in microseconds).

4

Calculate the time from an edge on port 1 to an edge on the
specified port (in microseconds).

5

Not used.

6

Not used.

7

Pulse counting period on port 7 or 8 (in microseconds).

8

Pulse counting frequency on port 7 or 8 (in Hz).

Timeout

A constant is entered for the Timeout parameter to determine the results to be
returned when no changes have occurred in the specified ports since the last
execution of the instruction. If the timeout period has expired and no change has
occurred, a null value will be returned (0 for frequency and NaN for period or
time since last edge). If the timeout period has not expired the last valid result
will be returned. This is useful for measuring signals with periods greater than
the scan interval. The maximum time out is 2

32

x the scan.

Advertising