I2c input/output, Usage, Bitshift input example – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual
Page 90: Bitshift output example
80
Serial I/O Models
kbaud (
const
-
expr
)
Specifies the bit rate. The expression
const-expr
can be 1, 10, or 15. The
default is 15. The firmware uses this value as a multiplier based on the
Series 3100 input clock or Series 5000 system clock. For example, for a
Series 3100 device at 10 MHz, kbaud(15) yields 15 kbps; for a Series 5000
device at 10 MHz, kbaud(15) yields 30 kbps. The bit rate scales
proportionally with the input or system clock.
io-object-name
A user-specified name for the I/O object, in the ANSI C format for variable
identifiers.
initial-output-level
A constant expression, in ANSI C format for initializers, used to set the state
of the clock pin at initialization. The initial state can be 0 or 1; this applies to
the clock pin only. The default is 0.
Usage
unsigned long
input-value
;
unsigned long
output-value
;
input-value
= io_in(
input-object
[,
numbits
]);
io_out(
output-object
,
output-value
[,
numbits
]);
Bitshift Input Example
IO_6 input bitshift numbits(8) ioShiftregister;
unsigned long data;
...
when (...) {
data = io_in(ioShiftregister);
}
Bitshift Output Example
IO_8 output bitshift numbits(5) clockedge(+) ioAdcControl;
...
when (...) {
io_out(ioAdcControl, 0b10010UL);
}
I2C Input/Output
The I
2
C I/O model type is used to interface a Neuron Chip or Smart Transceiver
to any device that uses the Inter-Integrated Circuit (I
2
C) bus protocol developed
by Philips Semiconductors (now NXP
®
Semiconductors). See the Bitshift,
Neurowire, SCI, SPI, or Touch I/O models for alternate forms of serial I/O.
This model applies to Series 3100 Neuron Chips and Smart Transceivers, and to
Series 5000 Neuron Processors and Smart Transceivers.