I/o functions for timer/counter objects – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 36

Advertising
background image

26

Introduction

I/O Functions for Timer/Counter Objects

For multiplexed I/O objects, the last timer/counter I/O object declared in the

program is the first to take effect after a reset. To change the selected I/O object,
use the io_select( ) function to specify which of the multiplexed pins is the owner

of the timer/counter circuit.
The syntax for the io_select( ) function is:

io_select (

io-object-name

[,

clock

] )

io-object-name

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

io-object-name

in the

I/O object declaration.

clock

Specifies a clock selector, which can be different from or the same as the clock

selector specified in the object’s declaration, in the range of 0 to 7. If you do

not specify a

clock

value in the call to the io_select( ) function, the

clock

value

is set to the value in the I/O object’s declaration.

Any timer/counter I/O object that has a

clock

argument in its declaration syntax

can also be reprogrammed to an alternate clock value by using the io_set_clock( )
function.
The syntax for the io_set_clock( ) function is:
io_set_clock (

io-object-name

,

clock

)

io-object-name

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

io-object-name

in the

I/O object declaration.

clock

Required clock selector value in the range of 0 to 7 (for Series 3100 devices) or
0 to 15 (for Series 5000 devices), regardless of the clock selector specified in

the object’s declaration. Some I/O objects might not function properly with

all clock values. See the description for a particular I/O object in Chapter 5,

Timer/Counter Input

, on page 123, and Chapter 6,

Timer/Counter Output

,

on page 155.
See Appendix A,

Timer/Counter Periods and Resolution

, on page 187, for a

description of how the io_set_clock( ) function affects the resolution and range

of certain timer/counter I/O models.

When io_set_clock( ) is used on multiplexed objects, the clock is changed
regardless of whether the object itself is currently selected.
Example: The following code fragment shows several examples of the use of
io_select( ) and io_set_clock( ):

IO_1 output pulsecount clock(3) outPulsecount;
IO_5 input period clock(2) inPeriod;
IO_6 input ontime clock(3) inOntime;

when (reset) {
io_set_clock(outPulsecount, 5);
io_select(inOntime);

Advertising