beautypg.com

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

Page 143

background image

I/O Model Reference

133

io-object-name

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

In Figure 50, an io_in( ) function call is executed sometime after the IO_4 input

signal is sensed as changing to high, but before it has changed back to low. The
first period, Period [1], is stored as a value in the array pointed to by the buffer

argument. If the io_in( ) function call occurs within the Period [2] time frame,
the data for Period [1] is lost.
Individual period measurements can be skipped if the sum of two consecutive

periods is less than 104 μs (for a Series 3100 device with a 10 MHz input clock),
regardless of the timer/counter clock setting. The minimum value scales with the

input clock.

Figure 50. Call to io_in(device, buffer, count)

If the IO_4 input pin has been at a constant level for longer than the overflow
period before the call to io_in( ) is made, the first value stored in the buffer is not

the maximum value, but rather the value for the next period.

Usage

unsigned int

count

;

unsigned long

input-buffer

[

buffer-size

];

count

= io_in(

io-object-name

,

input-buffer

,

count

);

Example

IO_4 input edgelog clock(7) ioTimeStream;

// The next object allows direct reading
// of time_stream level.
IO_4 input bit ioTimeStreamLevel;

unsigned int edges;
unsigned long buffer[20];
unsigned long preLoad = 0x4000;

when (reset) {
io_edgelog_preload(preLoad);
}

when (io_changes(ioTimeStreamLevel) to 1) {
int i;