beautypg.com

Totalcount input, Hardware considerations, Example – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 161

background image

I/O Model Reference

151

Example

IO_4 input quadrature ioDial;

long angle = 0;

when (io_update_occurs(ioDial)) {
angle += input_value; // integrate angle in software
}

Totalcount Input

The totalcount I/O model counts the number of input edges at the input pin since

the last io_in( ) operation, or since initialization. Thus, this model can count

external events, such as contact closures where it is important to keep an
accurate running total (see Figure 47 on page 125 and Figure 57 on page 152).
This model applies to Series 3100 Neuron Chips and Smart Transceivers, and to

Series 5000 Neuron Processors and Smart Transceivers.

Hardware Considerations

A timer/counter can be configured to count either rising or falling input edges,

but not both. Reading the value of a totalcount model gives the number of

transitions since the last time it was read (0 to 65535). Maximum frequency of
the input is one-quarter of the input clock rate for a Series 3100 device, or one-

half of the system clock rate for a Series 5000 device. For example, 2.5 MHz for a

Series 3100 device at a maximum of 10 MHz input clock.

A call to the io_in( ) function returns the current value of the totalcount value

corresponding to the total number of active clock edges since the last call. The
counter is then reset, and ready for the next series of input transitions.
The actual active edge of the input depends on whether the invert option is used

in the declaration of the I/O object. The default is the negative edge.