Introduction to Microcontrollers Lab Manual - Microchip
Introduction to Microcontrollers Lab Manual - Microchip
Introduction to Microcontrollers Lab Manual - Microchip
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
3.1 OBJECTIVE<br />
3.2 PRE-LAB<br />
<strong>Lab</strong> 3. UART<br />
This lab covers the following concepts:<br />
• PIC24F UART Hardware Module<br />
• PIC24F Peripheral Pin Select Hardware Module<br />
• ASCII Character Encoding<br />
3.2.1 Reference Material<br />
• PIC24FJ256GB110 Data Sheet (DS39897)<br />
• 16-Bit MCU and DSC Programmer’s Reference <strong>Manual</strong> (DS70157)<br />
• MPLAB IDE User’s Guide (DS51519)<br />
• PIC24F Reference <strong>Manual</strong> – Section 8. Interrupts (DS39707)<br />
• PIC24F Reference <strong>Manual</strong> – Section 12. Peripheral Pin Select (DS39711)<br />
• PIC24F Reference <strong>Manual</strong> – Section 21. UART (DS39708)<br />
3.2.2 UART (Universal Asynchronous Receiver/Transmitter)<br />
LABS<br />
A UART is a piece of hardware that uses a shift register <strong>to</strong> convert data between serial<br />
and parallel forms. As the name implies, each UART actually contains two pieces of<br />
hardware and therefore two shift registers, a Receiver (Rx) and a Transmitter (Tx).<br />
Simplified, a UART transmitter takes bytes (8 bits) of data and transmits them as individual<br />
bits in sequential fashion. Then another UART receiver at the other end takes<br />
those sequential bits and re-assembles them back in<strong>to</strong> bytes.<br />
The simple reason for this is that serial transmission across a single wire is much more<br />
cost effective then parallel transmission across multiple wires.<br />
The communication is actually a little more complicated then described above. The<br />
UART is an “asynchronous” receiver/transmitter. Therefore, some synchronization<br />
between transmitter and receiver is required. To accomplish this, both the transmitter<br />
and receiver must run at the same baud rate with a START and one or two STOP bits<br />
inserted in<strong>to</strong> the serial bit stream. Parity bits can also be inserted in<strong>to</strong> the bit stream for<br />
error detection. Figure 3-1 illustrates all possible bits in a serial bit stream.<br />
FIGURE 3-1: LAB 3 SERIAL TRANSMISSION OF BYTE<br />
A standard embedded UART configuration is 8 bits of data with no parity bit and one<br />
s<strong>to</strong>p bit. This is also referred <strong>to</strong> as 8N1 and is illustrated in Figure 3-2.<br />
2011 <strong>Microchip</strong> Technology Inc. DS51963A-page 25