Pulsecount output, Hardware considerations, Usage – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual
Page 178: Example
168
Timer/Counter Output Models
initial-output-level
A constant expression, in ANSI C format for initializers, used to set the state
of the output pin of the I/O object at initialization. The initial state can be 0
or 1. The default is 0.
Usage
unsigned long
output-value
;
io_out(
io-object-name
,
output-value
);
Example
IO_0 output oneshot ioFlash;
unsigned long pulse = 39062; // 1 second pulse
mtimer repeating flashTimer;
when (...) {
// start timer, flash every 2 secs
flashTimer = 2000;
}
when (timer_expires(flashTimer)) {
// outputs a 1 sec pulse
io_out(ioFlash, pulse);
}
Pulsecount Output
For Series 3100 devices, the pulsecount I/O model produces a sequence of pulses
whose period is a function of the clock period, calculated as follows:
period (ns) = 256 * 2000 * 2^(clock) / input_clock (MHz)
where clock ranges from 0..7
For Series 5000 devices, the pulsecount I/O model produces a sequence of pulses
whose period is a function of the clock period, calculated as follows:
period (ns) = 256 * 2000 * 2^(value) / 10 MHz
where value ranges from 0..15
This I/O model can perform average frequency measurements and implement
tachometers. You can use the pulsecount input to control devices that require a
precision count of pulses, such as stepper motors.
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 generate a series of pulses. The number of
pulses output is in the range 0 to 65535, and the output waveform is a square
wave with 50% duty cycle. This function suspends the current application
context until the pulse train is complete. See
Timer/Counter Square Wave