Programming considerations, Syntax – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 154

Advertising
background image

144 Timer/Counter

Input

Models

Programming Considerations

For

period-input

, the data type of the

return-value

for the io_in( ) function is an

unsigned long.

The input is latched every 50 ns for a Series 3100 device with a 40 MHz input

clock, or every 12.5 ns for a Series 5000 device with an 80 MHz system clock.

This value scales inversely with the input clock speed. If no edges occur during
the measuring period, an overflow condition occurs. The next io_in( ) function

call after the overflow has occurred returns the out-of-range value of 0xFFFF.

The io_update_occurs event is not asserted as TRUE unless the program uses the
io_preserve_input( ) function after the io_select( ) when using the multiplexed

timer/counter, or in the reset task when using the dedicated timer/counter.

Syntax

pin

[input] period [mux | ded] [invert] [clock (

const-expr

)]

io-object-name

;

pin

An I/O pin. Period input can specify pins IO_4 through IO_7.

mux | ded

Specifies whether the I/O object is assigned to the multiplexed or dedicated
timer/counter. This keyword only applies, and must be used, when pin IO_4

is the input pin.
The mux keyword assigns the I/O object to the multiplexed timer/counter.
The ded keyword assigns the I/O object to the dedicated timer/counter. The

multiplexed timer/counter is always used for pins IO_5 through IO_7.

invert

Causes the measurement of time between positive edges and typically has no

effect. By default, period input measures the time between negative edges.

clock (

const-expr

)

Specifies a clock in the range 0 to 7, where 0 represents the fastest clock and

7 represents the slowest clock. The default value is clock 0.

You can change resolution for the timer base clock frequency by calling the

io_set_clock( ) function with a clock value in the range 0..7 (using one of the

TCCLK_* macros defined in <echelon.h>). This function overrides the
resolution value specified for clock() within the I/O object declaration.
For an application running on a Series 5000 device, you can specify an

increased resolution for the timer base clock frequency by calling the
io_set_clock() function with a clock value in the range 0..15 (using one of the

TCCLK_* macros defined in <echelon.h>). This function overrides the

resolution value specified for clock() within the I/O object declaration.

See Appendix A,

Timer/Counter Periods and Resolution

, on page 187, for a

description of the timer resolution and maximum range for each specification
of the clock() value or each value of the TCCLK_* macros. See the

Neuron C

Reference Guide

for information about the io_set_clock() function.

Advertising