avr programming primer

Page 40

25

CHAPTER 2

Serial Communication Subsystem Objectives: After reading this chapter, the reader should be able to • • • • • • •

2.1

describe the differences between serial and parallel communication, provide definitions for key serial communications terminology, describe the operation of the USART, program the USART for basic transmission and reception, describe the operation of the SPI, program the SPI for basic transmission and reception, and describe the purpose of the two-wire interface (TWI).

SERIAL COMMUNICATIONS

Microcontrollers must often exchange data with other microcontrollers or peripheral devices. Data may be exchanged by using parallel or serial techniques. With parallel techniques, an entire byte of data is typically sent simultaneously from the transmitting device to the receiver device. Although this is efficient from a time point of view, it requires eight separate lines for the data transfer [1]. In serial transmission, a byte of data is sent a single bit at a time. Once 8 bits have been received at the receiver, the data byte is reconstructed. Although this is inefficient from a time point of view, it only requires a line (or two) to transmit the data. The ATmega16 is equipped with a host of different serial communication subsystems, including the serial USART, SPI, and TWI. What all of these systems have in common is the serial transmission of data. Before discussing the different serial communication features aboard the ATmega16, we review serial communication terminology.

2.2

SERIAL COMMUNICATION TERMINOLOGY

In this section, we review common terminology associated with serial communication.


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.