Io_changes event, I/o events, 22 for a descrip – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 32

Advertising
background image

22

Introduction

}
}

...

I/O Events

An alternative to using the explicit io_in( ) function is to associate an input object
with a predefined event or interrupt. The two I/O-related predefined events are:

• io_changes
• io_update_occurs

These events are used only with input objects. When they are evaluated, both

the io_update_occurs and io_changes events perform an implicit io_in( ) function
call to obtain an input value for the object. Your program can access this input

value by using the input_value variable.
You can also associate timer/counter I/O devices or individual I/O pins with
application interrupts on a Series 5000 device. See the

Neuron C Programmer’s

Guide

for more information about application interrupts.

io_changes Event

This event is TRUE when the value read from the specified input object changes

state. The change can be one of three types:

• Any change (an unqualified change)
• A change (in absolute value) by a specified amount (or greater)
• A change to a specified value

The syntax for this event is:

io_changes(

io-object-name

) [by

expr

| to

expr

]

The use of this event results in a comparison of the current value read from the

input object with a reference value (except for the to option). The

reference value

is the value that was read the last time the change event evaluated to TRUE

(and saved, at that time, by the firmware). For an io_changes event that does not

use either the by option or the to option, a state change occurs when the current
value is different from the reference value. When using the optional forms of the

io_changes event, the

expr

expression does not need to be a constant. However, a

constant expression is more efficient.

The io_changes event for a timer/counter input device occurs only if the device

has a new value, different from the previous value. For the timer/counter devices,

the io_changes event happens as listed in Table 8, depending on the input object
type.

Table 8. io_changes Events for Specific I/O Models

I/O Model

Event

dualslope

Event occurs when the conversion is complete.

Advertising