Syntax, Usage, Example – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual
Page 157
I/O Model Reference
147
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. The value of a pulsecount input
object is updated every 0.8388608 seconds and the io_update_occurs event
becomes TRUE.
If no edges occur during the measuring period, an overflow condition occurs. The
next io_in( ) function call after the overflow has occurred will return 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 io_select( ) when
using the multiplexed timer/counter, or in the reset task when using the
dedicated timer/counter.
Syntax
pin
input pulsecount [mux | ded ] [invert]
io-object-name
;
pin
An I/O pin. Pulsecount 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 is used only when pin IO_4 is used as 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 positive edges to be counted. Typically this keyword has no effect
because the number of positive edges equals the number of negative edges.
By default, pulsecount input counts the number of negative input edges.
io-object-name
A user-specified name for the I/O object, in the ANSI C format for variable
identifiers.
Usage
unsigned long
input-value
;
input-value
= io_in(
io-object-name
);
Example
IO_7 input pulsecount ioTotalTicks;
unsigned long ticks;
when (io_update_occurs(ioTotalTicks)) {
ticks = input_value;
// for up to 65535 ticks per 0.839 seconds
}