beautypg.com

Edgelog input, Usage, Example – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 139

background image

I/O Model Reference

129

TCCLK_* macros defined in ). This function overrides the

resolution value specified for clock() within the I/O object declaration.

See Appendix A,

Timer/Counter Periods and Resolution

, on page 187, for a

description of the timer resolution and maximum range for each specification

of the clock() value or each value of the TCCLK_* macros. See the

Neuron C

Reference Guide

for information about the io_set_clock() function.

io-object-name

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

identifiers.

Usage

unsigned long

input-value

,

control-value

;

io_in_request(

io-object-name

,

control-value

);

input-value

= io_in(

io-object-name

);

Example

IO_4 input dualslope ded clock(0) ioDualSlope;
mtimer repeating goTime;
unsigned long data;
...

when (reset) {
goTime = 500; // Perform a measurement every 500ms
}

when (timer_expires(goTime)) {
// Start the first integration period (9ms at 10MHz).
io_in_request(ioDualSlope, 45000UL);
}

when (io_update_occurs(ioDualSlope)) {
// The value at input_value is biased by the
// negative value of the control value used.
// Correct this by adding it back now.
data = input_value + 45000UL;
}

Edgelog Input

The edgelog I/O model can record a stream of input pulses that measure the
consecutive low and high periods at the input and store them in user-defined

storage (see Figure 49 on page 130). The values stored represent the units of

clock period between rising and falling input signal edges.

For a Series 3100 device, this I/O model measures a series of both high and low

input signal periods on a single input pin, IO_4, in units of the clock period:

time_on/time_off (ns) = value_stored * 2000 * 2^(clock) / input_clock (MHz)

where clock ranges from 0..7