Io_preserve_input( ) built-in function, Syntax, Example – Echelon Neuron C User Manual
Page 121: Io_select( ) built-in function
Neuron C Reference Guide
101
io_preserve_input( )
Built-in Function
The io_preserve_input( ) built-in function is used with an input timer/counter I/O
object. If this function is not called, the Neuron firmware discards the first
reading on a timer/counter object after a reset (or after a device on the
multiplexed timer/counter is selected using the io_select( ) function because the
data might be suspect due to a partial update). Calling the io_preserve_input( )
function prior to the first reading, either by an io_in( ) or implicit input, overrides
the discard logic.
The io_preserve_input( ) call can be placed in a when (reset) clause to preserve
the first input value after reset. The call can be used immediately after an
io_select( ) call to preserve the first value after select.
Syntax
void io_preserve_input (
input-io-object-name
);
input-io-object-name
Specifies the I/O object name that corresponds to
io-object-name
in the I/O declaration. This built-in
function is only applicable to input timer/counter I/O
objects.
Example
IO_5 input ontime ot1;
IO_6 input ontime ot2;
unsigned long variable1;
when (io_update_occurs(ot1))
{
variable1 = input_value;
io_select(ot2);
io_preserve_input(ot2);
}
io_select( )
Built-in Function
The io_select( ) built-in function selects which of the multiplexed pins is the
owner of the timer/counter circuit, and optionally specifies a clock for the I/O
object. Input to one of the timer/counter circuits can be multiplexed among pins
4 to 7. The other timer/counter input is dedicated to pin 4.
When io_select( ) is used, the I/O object automatically discards the first value
obtained.
Syntax
void io_select (
input-io-object-name
[,
clock-value
]);
input-io-object-name
The I/O object name that corresponds to
io-object-name
in the I/O declaration. This built-in
function is used only for the following timer/counter input
objects: