beautypg.com

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

Page 160

background image

150 Timer/Counter

Input

Models

Programming Considerations

A signed long value is returned from the io_in( ) function, based on the change
since the last input. The input is sampled 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.

For Series 3100 devices, add a #pragma enable_io_pullups directive to enable the

Neuron Chip's or Smart Transceiver's built-in pull-up resistors.
For more information on quadrature input, see the

Neuron Chip Quadrature

Input Function Interface

engineering bulletin (part number 005-0003-01).

Syntax

pin

[input] quadrature

io-object-name

;

pin

An I/O pin. Quadrature input requires two adjacent pins. The pin
specification denotes the lower-numbered pin of the pair. The pin can be

IO_4 (which uses the dedicated timer/counter) or IO_6 (which uses the

multiplexed timer/counter).
Figure 56 shows the use of the two signal inputs A and B. Both edges of

input A are counted. Input B indicates whether input A is moving in a

positive or a negative direction.

io-object-name

A user-specified name for the I/O object, in the ANSI C format for variable

identifiers.

Figure 56. Quadrature Input

Usage

long

input

-

value

;

input

-

value

= io_in(

io

-

object

-

name

);