When using flow control,
a serin2 statement sets its FlowPin output to enable receiving data. A serout2
statement waits for its FlowPin input to be asserted before sending data. An
optional timeout value causes the code to jump to a label if the pin isn??™t asserted
within the specified time. In most cases, however, a hardware UART??™s capabilities
are more useful than the added features of a firmware UART.
0. 1
Another way to add a serial port is via an interface to an external UART.
The 16550 UART used in PCs for many years has eight data pins plus various
address, status, and control pins. Many microcontrollers don??™t have enough
port pins to interface to this and similar chips. An alternative is a UART with a
synchronous serial interface.
# ";
, !#5
A chip that requires as few as three lines for a bidirectional link is Maxim??™s
MAX3100 SPI/Microwire UART. The chip converts between synchronous and
asynchronous serial data (Figure 11-2). The synchronous data is compatible
with SPI and Microwire, which require a clock line plus a data line for each
direction.
Chapter 11
264
A microcontroller can communicate with the MAX3100 by sending and receiving
synchronous data. The microcontroller can toggle SCLK as needed without
worrying about maintaining a specific bit rate. The only restrictions on SCLK??™s
frequency are a minimum pulse width (high or low) of 100 ns and a minimum
clock period (high + low) of 238 ns.
Pages:
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290