11
"
#
Many serial-port communications are between embedded systems or between
embedded systems and PCs. This chapter shows how to program serial commu-
nications for an embedded system’s microcontroller. The code examples are for
Microchip Technology’s PIC18F4520, with each example provided for both
microEngineering Labs, Inc.’s PICBASIC PRO compiler and Microchip’s
MPLAB C18 C compiler. The concepts and much of the code are portable to
other chip architectures and compilers.
## #
Microchip’s PIC microcontrollers are inexpensive, widely available, and include
variants to suit a range of applications. Many of the chips have hardware sup-
port for asynchronous serial communications.
Other microcontrollers support serial ports as well. The details vary, but sup-
port typically consists of a hardware UART or USART with a series of registers
to configure the port, monitor events, and store received data and data to send.