0% found this document useful (0 votes)
35 views42 pages

EEC 214 Lecture 2

The document discusses microcontrollers and embedded processors. It provides details about the AVR microcontroller such as its history, features, architecture, assembly language, registers, memory, and status register. It notes that the AVR is an 8-bit RISC microcontroller that contains CPU, RAM, ROM, I/O ports, and timers on a single chip. It has 32 general purpose registers and uses instructions like ADD that can affect status register flags to enable conditional branching.

Uploaded by

yhya Tarek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views42 pages

EEC 214 Lecture 2

The document discusses microcontrollers and embedded processors. It provides details about the AVR microcontroller such as its history, features, architecture, assembly language, registers, memory, and status register. It notes that the AVR is an 8-bit RISC microcontroller that contains CPU, RAM, ROM, I/O ports, and timers on a single chip. It has 32 general purpose registers and uses instructions like ADD that can affect status register flags to enable conditional branching.

Uploaded by

yhya Tarek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

EEC 214

Computer
Microprocessor

Lecture 2
MICROCONTROLLERS AND EMBEDDED PROCESSORS
By microprocessor is meant the general-purpose microprocessors such as Intel’s x86 family
(8086, 80286, 80386, 80486, and the Pentium) or Motorola’s PowerPC family. These
microprocessors contain no RAM, no ROM, and no I/O ports on the chip itself. For this reason,
they are commonly referred to as general-purpose microprocessor.

A microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM, ROM,


I/O ports, and a timer all on a single chip.

Computer Microprocessor Dr. Mohamed A. Torad 2


A brief history of the AVR microcontroller
The basic architecture of AVR was designed by two students of Norwegian Institute of
Technology (NTH), Alf-Egil Bogen and Vegard Wollan, and then was bought and developed by
Atmel in 1996.

You may ask what AVR stands for; AVR can have different meanings for different people! Atmel
says that it is nothing more than a product name, but it might stand for Advanced Virtual RISC,
or Alf and Vegard RISC (the names of the AVR designers).

There are many kinds of AVR microcontroller with different properties. Except for AVR32,
which is a 32-bit microcontroller, AVRs are all 8-bit microprocessors, meaning that the CPU can
work on only 8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to
be processed by the CPU.

Computer Microprocessor Dr. Mohamed A. Torad 3


AVR features
The AVR is an 8-bit RISC single-
chip microcontroller with Harvard
architecture that comes with some
standard features such as on-chip
program (code) ROM, data RAM,
data EEPROM, timers and I/O
ports. See Figure 2. Most AVRs
have some additional features like
ADC, PWM, and different kinds
of serial interface such as USART,
SPI, I2C (TWI), CAN, USB, and
so on. See Figures 3 and 4.

Computer Microprocessor Dr. Mohamed A. Torad 4


AVR features

Computer Microprocessor Dr. Mohamed A. Torad 5


AVR features

Most of the AVRs come with ADC (analog-to-digital converter), timers, and USART (Universal
Synchronous Asynchronous Receiver Transmitter) as standard peripherals. The ADC is 10-bit
and the number of ADC channels in AVR chips varies and can be up to 16, depending on the
number of pins in the package. The AVR can have up to 6 timers besides the watchdog timer. The
USART peripheral allows us to connect the AVR-based system to serial ports such as the COM
port of the x86 IBM PC. Most of the AVR family members come with the I2C and SPI buses and
some of them have USB or CAN bus as well.

Computer Microprocessor Dr. Mohamed A. Torad 6


AVR features

Computer Microprocessor Dr. Mohamed A. Torad 7


AVR features

Computer Microprocessor Dr. Mohamed A. Torad 8


AVR features

Computer Microprocessor Dr. Mohamed A. Torad 9


Other microcontrollers

Computer Microprocessor Dr. Mohamed A. Torad 10


THE GENERAL PURPOSE REGISTERS IN the AVR

AVR microcontrollers have many registers for arithmetic and logic operations. In the CPU,
registers are used to store information temporarily. That information could be a byte of data to be
processed, or an address pointing to the data to be fetched. The vast majority of AVR registers are
8-bit registers. In the AVR there is only one data type: 8-bit. The 8 bits of a register are shown in
the diagram below. These range from the MSB (most-significant bit) D7

In AVR there are 32 general purpose registers. They are R0–R31 and are
located in the lowest location of memory address.

See Figure 1.

All of these registers are 8 bits.

Computer Microprocessor Dr. Mohamed A. Torad 11


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 12


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 13


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 14


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 15


THE AVR DATA MEMORY

Computer Microprocessor Dr. Mohamed A. Torad 16


THE AVR DATA MEMORY

Computer Microprocessor Dr. Mohamed A. Torad 17


THE AVR DATA MEMORY

Computer Microprocessor Dr. Mohamed A. Torad 18


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 19


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 20


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 21


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 22


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 23


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 24


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 25


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 26


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 27


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 28


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 29


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 30


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 31


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 32


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 33


AVR ARCHITECTURE AND ASSEMBLY LANGUAGE

Computer Microprocessor Dr. Mohamed A. Torad 34


AVR status register
The flag register in the AVR is called the status register (SReg).

Computer Microprocessor Dr. Mohamed A. Torad 35


AVR status register

Computer Microprocessor Dr. Mohamed A. Torad 36


ADD instruction and the status register

Computer Microprocessor Dr. Mohamed A. Torad 37


ADD instruction and the status register

Computer Microprocessor Dr. Mohamed A. Torad 38


ADD instruction and the status register

Computer Microprocessor Dr. Mohamed A. Torad 39


ADD instruction and the status register

Computer Microprocessor Dr. Mohamed A. Torad 40


Not all instructions affect the flags

Computer Microprocessor Dr. Mohamed A. Torad 41


Flag bits and decision making
There are instructions that will make a conditional jump (branch) based on the status of the flag
bits. Table 5 provides some of these instructions.

Computer Microprocessor Dr. Mohamed A. Torad 42

You might also like