I/o measurements, outputs, and functions, Direct, serial, and parallel i/o models, Timer/counter i/o models – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 38

Advertising
background image

28

Introduction

int slope1Clock = 2;
IO_5 input ontime clock (2) ioSlope1;
IO_6 input period clock (1) ioCycleA;
// Following reset, the ioCycleA object is selected
// because it is the last object declared using the mux

when (io_update_occurs(ioSlope1)) {
if (input_value > 0x4000 && slope1Clock == 2) {
// Range down (slower)
slope1Clock = 4;
io_set_clock(ioSlope1, slope1Clock);
} else if (input_value < 0x4000 && slope1Clock == 4) {
// Range up (faster)
slope1Clock = 2;
io_set_clock(ioSlope1, slope1Clock);
} else {
// Save the measured value, select the other object
slope1Raw = input_value;
io_select(ioCycleA);
}
// If auto-ranging has occurred, another measurement
// will be made. Otherwise, the ioCycleA object
// will be measured next.
}

when (io_update_occurs(ioCycleA)) {
cycleAValue = input_value;
// Now select the ioSlope1 object,
// using the current clock range computed above
io_select(ioSlope1, slope1Clock);
}

I/O Measurements, Outputs, and Functions

This section describes when the I/O pins are sampled or set, depending on the I/O

model.

Direct, Serial, and Parallel I/O Models

For direct I/O models, input levels are sampled when an io_in( ) function is

called, or when a when clause that references the object is evaluated.
For serial and parallel I/O models, input levels are sampled when the io_in( )
function is called. For a Series 3100 device with a 40 MHz input clock, output

levels are set approximately 12.5 to 25 microseconds after invocation of the

io_out( ) function. This timing value scales with the input clock speed. See the
specific I/O model for detailed timing diagrams.

Timer/Counter I/O Models

Values for timer/counter input models are latched periodically depending on the

model or the I/O object clock. The relationship between when an io_in( ) function
or an I/O when clause is used and when the data has been latched is usually

application dependent. After a value is latched, that value continues to be

Advertising