Hardware Reference
In-Depth Information
Atmel Microcontroller
At the heart of every Arduino is an Atmel microcontroller unit (MCU). Most
Arduino boards, including the Arduino Uno, use an AVR ATMega microcontroller.
The Arduino Uno in Figure 1-1 uses an ATMega 328p. The Due is an exception;
it uses an ARM Cortex microcontroller. This microcontroller is responsible for
holding all of your compiled code and executing the commands you specify. The
Arduino programming language gives you access to microcontroller peripherals,
including analog-to-digital converters (ADCs), general-purpose input/output
(I/O) pins, communication buses (including I 2 C and SPI), and serial interfaces.
All of this useful functionality is broken out from the tiny pins on the micro-
controller to accessible female headers on the Arduino that you can plug wires
or shields into. A 16 MHz ceramic resonator is wired to the ATMega's clock
pins, which serves as the reference by which all program commands execute.
You can use the Reset button to restart the execution of your program. Most
Arduino boards come with a debug LED already connected to pin 13, which
enables you to run your first program (blinking an LED) without connecting
any additional circuitry.
Programming Interfaces
Ordinarily, ATMega microcontroller programs are written in C or Assembly
and programmed via the ICSP interface using a dedicated programmer (see
Figure 1-2). Perhaps the most important characteristic of an Arduino is that
you can program it easily via USB, without using a separate programmer. This
functionality is made possible by the Arduino bootloader. The bootloader is
loaded onto the ATMega at the factory (using the ICSP header), which allows a
serial USART (Universal Synchronous/Asynchronous Receiver/Transmitter) to
load your program on the Arduino without using a separate programmer. (You
can learn more about how the bootloader functions in “The Arduino Bootloader
and Firmware Setup” sidebar.)
In the case of the Arduino Uno and Mega 2560, a secondary microcontroller
(an ATMega 16U2 or 8U2 depending on your revision) serves as an interface
between a USB cable and the serial USART pins on the main microcontroller. The
Arduino Leonardo, which uses an ATMega 32U4 as the main microcontroller,
has USB baked right in, so a secondary microcontroller is not needed. In older
Arduino boards, an FTDI brand USB-to-serial chip was used as the interface
between the ATMega's serial USART port and a USB connection.
Search WWH ::




Custom Search