beautypg.com

Io_out( ) function – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 30

background image

20

Introduction

return-value

= io_in (

io-object-name

[,

args

] )

return-value

The current value read from the input device. The data type of the return

value and its semantics are a function of the I/O model implemented by this

I/O object.

io-object-name

The name for the I/O object, which corresponds to the

io-object-name

in the

I/O object declaration.

args

Arguments that depend on the type of the I/O model. Some of these
arguments can also appear in the I/O object declaration. If specified in both

places, the value of the function argument overrides the declared value for

the specific function call only. If the value is not specified in either the
function argument or the declaration, the default value is used.

Example: The io_in( ) function returns the value of the ioProximity proximity

detector declared earlier:

detected = io_in(ioProximity);

See the

Neuron C Reference Guide

for object-specific rules that apply to this

function.

io_out( ) Function

When a program needs to send signals to a peripheral device, declare an output

object and use the built-in io_out( ) function.
The syntax for the io_out( ) function is:

io_out (

io-object-name, output-value

[,

args

] )

io-object-name

The name for the I/O object, which corresponds to the

io-object-name

in the

I/O object declaration.

output-value

The value that the function should set for the output device. The data type of
the value and its semantics are a function of the I/O model implemented by

this I/O object.

args

Arguments that depend on the type of the I/O model. Some of these

arguments can also appear in the I/O object declaration. If specified in both
places, the value of the function argument overrides the declared value for

the specific function call only. If the value is not specified in either the

function argument or the declaration, the default value is used.

Example 1: A lamp device could use the io_out( ) function to turn the lamp on:

io_out(ioLamp, 0);

Example 2: A relay is attached to the IO0 pin (with appropriate driver circuitry).

The declaration syntax for this simple device is: