Overlaying i/o objects, Timer/coun – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 27

Advertising
background image

I/O Model Reference

17

io-object-name

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

The description for each I/O object includes a detailed explanation of the syntax

for each I/O model.

Example: A logic level needs to be measured at the IO3 input pin of the device,

which is named IO_3 in Neuron C. The pin is connected to a proximity detector,
as its programmatic name indicates.

IO_3 input bit ioProximity;

Your program can now refer to the IO3 binary input through the ioProximity

variable when using utility functions for this I/O object.

Overlaying I/O Objects

For some I/O models, you can declare more than one I/O object for the same pin.
That is, you can

overlay

one I/O object on another.

Example 1: The following declarations allow a program to read four adjacent

pins in one operation (with the nibble I/O model) or read each pin individually
(with the bit I/O model):

IO_4 input nibble ioAllPoints;
IO_4 input bit ioPoint1;
IO_5 input bit ioPoint2;
IO_6 input bit ioPoint3;
IO_7 input bit ioPoint4;

Example 2: The following declarations enable a program to monitor (read back)
the level on its own oneshot output object:

IO_1 output oneshot clock (3) ioBreakHigh;
IO_1 input bit ioBreakHighLevel;

With respect to overlaying, I/O models can be divided into hard pin direction I/O
models and soft pin direction I/O models:

• The

soft

pin direction I/O models (bit, nibble, and byte) are changed by

subsequent pin declarations. When multiple soft pin direction I/O objects

are declared for the same pin, the last soft I/O object declared is the one

that affects the initial direction of the pin at run-time.

• The

hard

pin direction I/O models (all other I/O models) are not affected

by subsequent declarations.

The io_set_direction( ) function allows the application to change the direction of

any bit, nibble, or byte type I/O object at run time. See the

Neuron C Reference

Guide

for information about the io_set_direction( ) function.

In example 2 above, the oneshot model is a hard pin direction I/O model, but the

bit model is a soft pin direction I/O model. The order of declarations is not

important, and the oneshot object is the one that affects the direction of pin IO1
(set during initialization and after reset).
Example 3: If a program declares the following:

IO_2 input bit ioPoint1;
IO_2 output bit ioPoint2;

Advertising