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

Page 146

Advertising
background image

136 Timer/Counter

Input

Models

• A

bit_count

argument, which is the expected number of data bits to be

received and stored

• A

max_period

argument limiting the range of the timer/counter

measurement process

• A

threshold

argument, representing the half way point, in timer/counter

count clocks, between a zero data period and a one data period

The value returned by the io_in( ) function is the actual number of bits read. If

less than the expected number of bits (controlled by

bit_count

) appear at the

input pin, the io_in( ) function waits for the

max_period

period before returning.

If the expected number of bits, or more, appear at the input pin, the io_in( )

function waits for silence at the input pin before returning. Silence is defined as

a lack of input cycles for the

max_period

period. If input cycles persist, the

function returns after 256 input cycles occur. This data may be retrieved using

the tst_bit( ) function.

The

max_period

argument is an unsigned long, and is passed as the negative

(two's complement) of the required value. The threshold argument is passed as

the

max_period

value plus the required threshold value. See

Example

on page

137. The edgelog input object type can be used to read inputs from infrared

devices that do not conform to the assumptions of the infrared input model.

Syntax

pin

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

const-expr

)]

io-object-name

;

pin

An I/O pin. Infrared 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 field 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 on pins IO_5 through IO_7.

invert

Causes the measurement of the cycle period to be between positive input

edges rather than the default, which is between negative input edges.

clock (

const-expr

)

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

slowest clock. The default clock for infrared input is clock 6. The

io_set_clock( ) function can be used to change the clock. Table 52 on page 137
shows the clock values for a Series 3100 device with an input clock of 10 MHz

and a Series 5000 device with a system clock of 80 MHz. The values in the

table can be adjusted for different input clocks by scaling them inversely
proportional to the change in input clock (for example, for a 20 MHz clock,

divide all values in the table by 2, and for a 5 MHz clock, multiply all values
in the table by 2).

Advertising