Byte input/output, Hardware considerations, Usage – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual
Page 45: Bit input example, Bit output example
I/O Model Reference
35
Usage
unsigned int
input-value
;
unsigned int
output-value
;
input-value
= io_in(
io-object-name
);
io_out(
io-object-name, output-value
);
Bit Input Example
IO_1 input bit ioSwitch; // declares pin IO1 as a
// bit input object named ioSwitch
unsigned int switch_on_off;
...
when (reset) {
io_change_init(ioSwitch);
}
when (io_changes(ioSwitch)) {
switch_on_off = input_value;
}
Bit Output Example
IO_2 output bit ioLed;
unsigned int led_on_off;
...
when(...) {
io_out(ioLed, led_on_off);
}
Byte Input/Output
The byte I/O model is used to read or control eight pins simultaneously.
This model applies to Series 3100 Neuron Chips and Smart Transceivers, and to
Series 5000 Neuron Processors and Smart Transceivers.
Hardware Considerations
Pins IO0 – IO7 can be configured as a byte-wide input or output port, which can
be read or written using integers in the range 0 to 255. This is useful for reading
or writing a synchronized process image, where multiple binary outputs are
assigned (or sampled) simultaneously. Other uses include driving devices that
require ASCII data, or other data, eight bits at a time. For example, an
alphanumeric display panel can use byte function for data, and use pins IO8 –
IO11 in bit function for control and addressing.
For Series 3100 devices, the high (20 mA) current sink capability of pins IO0 –
IO3 (see Figure 10 on page 36) allows these pins to drive many I/O devices
directly.