Serial input/output, Hardware considerations, Example – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual
Page 113
I/O Model Reference
103
Example
#pragma specify_io_clock "10 MHz"
IO_8 sci twostopbits baud(SCI_2400) ioSci;
unsigned short buffer[20];
when (...) {
io_set_baud(ioSci, SCI_38400); // Optional baud change
io_out_request(ioSci, buffer, 20);
}
when (io_out_ready(ioSci)) {
unsigned short sciError;
sciError = sci_get_error(ioSci));
if (sciError) {
// Process SCI error
...
}
else {
// Process end of SCI transmission
...
}
}
Serial Input/Output
The serial I/O model is used to transfer data using an asynchronous serial data
format, such as EIA-232 (formerly RS-232) and Serial Communications Interface
(SCI) communications. This I/O model is useful for devices such as intelligent
LCD displays, terminals, modems, and computer serial interfaces. External
driver circuitry is required to adjust the signal voltage levels to be compatible to
the EIA-232 standard.
Important: The serial I/O model is provided for legacy support. Echelon
recommends using the SCI (UART) model instead of the legacy software serial
I/O model (see
on page 98). The hardware UART
provides higher performance with lower software overhead.
This model applies to Series 3100 Neuron Chips and Smart Transceivers, and to
Series 5000 Neuron Processors and Smart Transceivers.
Hardware Considerations
Pin IO8 can be configured as an asynchronous serial input line, and pin IO10 can
be configured as an asynchronous serial output line. The bit rates for input and
for output can be independently specified to be 600, 1200, 2400, or 4800
bits/second for a Series 3100 device with a 10 MHz input clock rate, or 4800,
9600, 19200, 38400, or 76800 bits/second for a Series 5000 device with an 80 MHz
system clock. The data rate scales proportionally to the input clock rate.
Either a serial input or a serial output operation (but not both) can be in effect at
any one time. The interface is half-duplex only. This function suspends
application processing until the operation is completed. If the stop bit has the
wrong polarity (it should be a 1), the input operation is terminated with an error.