SlidePub
Home
Categories
Login
Register
Home
General
AVR_ Microcontroller_Muhammad Ali_Mazidi_AVR_Lecture3_Fall2023
AVR_ Microcontroller_Muhammad Ali_Mazidi_AVR_Lecture3_Fall2023
harismohsin
93 views
61 slides
Aug 17, 2024
Slide
1
of 61
Previous
Next
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
About This Presentation
AVR Microcontroller Muhammad Ali Mazidi
Size:
1.11 MB
Language:
en
Added:
Aug 17, 2024
Slides:
61 pages
Slide Content
Slide 1
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
AVR Architecture and Assembly AVR Architecture and Assembly
Language ProgrammingLanguage Programming
Chapter 3Chapter 3
The AVR microcontroller
and embedded
systems
using assembly and c
Slide 2
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
The General Purpose Registers in the AVRThe General Purpose Registers in the AVR
•CPU use many registers to store data temporarily.
•AVR microcontrollers have many registers for arithmetic and logical operations.
•The vast mjority of AVR registers are 8 bit registers.
•In AVR there is only on data type: 8 bit.
•If data larger than 8 bits must be broken into 8 bit chunks before it is processed.
•In AVR there are 32 general purpose registers.
Slide 3
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•All of these registers are 8 bits.
•To understand the use of the general purpose registers, we will show it in the context
of two simple instructions: LDI and ADD
•LDI instruction
•K is an 8 bit value that can be 0 - 255 in decimal, or 00 - FF in hex, and Rd is R16 to
R31 (any of the upper 16 general purpose registers).
•The I in LDI stands for "immediate".
•The following instruction loads the R20 register with a value of 0x25 (25 in hex).
•The following instruction loads the R31 register with a value of 0x87 (87 in hex).
Slide 4
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•The following instruction loads the R25 register with a value of 0x79 (79 in hex and 121
in decimal).
•Note: We cannot load values into registers R0 to R15 using the LDI instruction. For
example the following instruction is not valid:
• LDI R5, 0x99 ; invalid instruction
•Notice the position of the source and destination operands.
•To write a comment in Assembly language we use ';' it is the same as '//' in C
language.
•When programming the GPRs of the AVR microcontroller with an immediate value, the
following points should be noted:
Slide 5
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•ADD instruction
•The ADD instruction has the following format:
•The ADD instruction tells the CPU to add the value of Rr to Rd and put the result back
into the Rd register.
•The affect of arithmetic and logic operations on the status register will be discussed
later.
Slide 6
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
The AVR Data MemoryThe AVR Data Memory
•In AVR microcontroller there are two kinds of memory space: code memory space and
data memory space.
•Our program is stored in code memory space, whereas the data memory stores data.
•The data memory is composed of three parts: GPRs (general purpose registers), I/O
memory, and internal data SRAM.
Slide 7
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•GPRs (general purpose registers)
•GPRs use 32 bytes of data memory space.
•They always take the address location $00 - $1F in the data memory space.
•The I/O memory (SFRs)
•The I/O memory is dedicated to specific functions such as status register, timers, serial
communication, I/O ports, ADC, and so on.
•The function of each I/O memory location is fixed by the CPU designer at the time of
design because it is used for control of the microcontroller or peripherals.
•All of the AVRs have at least 64 bytes of I/O memory locations. This 64-byte section is
called standard I/O memory.
•In AVRs with more than 32 I/O pins there is also an extended I/O memory, which
contains the registers for controlling the extra ports and the extra peripherals.
•In other microcontrollers the I/O registers are called SFRs (special function registers).
•THE GPRs used for storing general data.
Slide 8
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 9
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Internal data SRAM
•Internal data SRAM is widely used for storing data and parameters by AVR
programmers and C compilers.
•Generally this is called scratch pad.
•Each location of the SRAM can be accessed directly by its address.
•SRAM vs. EEPROM in AVR chips
•AVR has an EEPROM memory that is used for storing data.
•EEPROM does not lose its data when power is off, whereas SRAM does.
•The three part of the data memory (GPR’s, SFRs, and the internal SRAM) are made of
SRAM.
Slide 10
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Using Instructions with the DATA MemoryUsing Instructions with the DATA Memory
•The instructions we have used so far worked with the immediate (constant) value of K
and the GPRs.
•They also used the GPRs as their destination.
•The AVR allows direct access to other locations in the data memory.
•LDS instruction (LoaD direct from data Space)
•The LDS instruction tells the CPU to load (copy) one byte from an address in the data
memory to the GPS
•After this instruction is executed, the GPR will have the same value as the location in
the data memory.
•The location in the data memory can be in any part of the data space; it can be one of
the I/O registers, a location in the internal SRAM, or a GPR.
Slide 11
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•You can see the execution of LDS R0, 0x300 and LDS R1, 0x302 instruction below.
Slide 12
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•STS instruction (Store direct to data Space)
•The instruction tells the CPU to store (copy) the content of the GPR to an address
location in the data memory space.
•For example, the “STS 0x1, R10” instruction will copy the content of R10 into location
1.
•The following program first loads the R16 register with value 0x55, then moves this
value around to I/O registers of port B, C, and D. As shown in figure the address of
PORTB, PORTC and PORTD are 0x38, 0x35 and 0x32, respectively.
•PORTB, PORTC and PORTD are part of the special function registers in the I/O
memory. They can be connected to the I/O pins of the AVR microcontroller. We can
also store the content of a GPR into any location in the SRAM region of the data
space.
Slide 13
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Notice that you cannot copy (store) an immediate value directly into the SRAM location
in the AVR. This must be done via the GPRs.
•IN instruction (In from I/O location)
•The IN instruction tells the CPU to load one byte from an I/O register to the GPR. After
this instruction is executed, the GPR will have the same value as the I/O register.
•For example, the “IN R20, 0x16” instruction will copy the contents of location 16 (in
hex) of the I/O memory into R20.
Slide 14
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 15
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 16
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 17
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•To work with the I/O registers more easily, we can use their names instead of their I/O
addresses. For example, the following instruction loads R19 with the contents of PIND
• IN R19, PIND ; load R19 with PIND
Slide 18
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•OUT instruction (OUT to I/O location)
•The OUT instruction tells the CPU to store the GPR to the I/O register. After the
instruction is executed the I/O register will have the same value as the GPR.
•For example, the “OUT PORTD, R10” instruction will copy the contents of R10 into
PORTD (location 12 of the I/O memory).
Slide 19
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•MOV instruction
The MOV instruction is used to copy data among the GPR registers of R0 – R31.
For example, the following instruction copies the content of R20 to R10
MOV R10, R20 ; R10 = R20
More ALU instruction involving the GPRs
The following program adds 0x19 to the content of location 0x220 and stores the result in
location 0x221:
Slide 20
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 21
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 22
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 23
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 24
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
AVR Status RegisterAVR Status Register
•Like all other microprocessors, the AVR has a flag register to indicate arithmetic
conditions such as the carry bit.
•The flag register in the AVR is called the status register (SReg).
•AVR status register
•The status register is an 8-bit register.
•It is also referred to as the flag register.
•The bits C, Z, N, V, S, and H are called conditional flags, meaning that they indicate
some conditions that result after an instruction is executed.
Slide 25
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•The following is a brief explanation of the flag bits of the status register.
Slide 26
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 27
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•ADD instruction and the status register
•We examine the impact of the ADD instruction on the flag bit C, H, and Z of the status
register.
•Although all the flag bits C, Z, H, V, S and N are affected by the ADD instruction, we
will focus on flags C, H, and Z for now.
•The other flag bits relate only to signed number operations.
Slide 28
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 29
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 30
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 31
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Not all instruction affect the flags
•Some instruction affect all the six flags bit C, H, Z, S, V and N (e.g. ADD). But some
instruction affect no flag bit at all.
Slide 32
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
AVR Data Format and DirectivesAVR Data Format and Directives
•AVR data type
•The AVR microcontroller has only one data type. It is 8 bits, and the size of each
register is also 8 bits.
•Data format representation
•There are four ways to represent a byte of data in the AVR assembler. The number
can be in hex, binary, decimal, or ASCII formats.
•Hex numbers
•Binary number
Slide 33
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Decimal numbers
•ASCII characters
Slide 34
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Assembler directives
•While instruction tell the CPU what to do, directives (also pseudo-instructions) give
direction to the assembler. For example, the LDI and ADD instructions are command to
the CPU, but .EQU, .DEVICE, and .ORG are directives to assembler.
•.EQU (equate)
•This is used to define a constant value or a fixed address.
•.EQU COUNT = 0x25
•------- ---------
•LDI R21, COUNT ; R21 = 0x25
Slide 35
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•.SET FOO = 0x114; set FOO to point to an SRAM location
•lds r0, FOO; load location into r0
•.SET FOO = FOO + 1 ; increment (redefine) FOO. This would be illegal if using .EQU
•lds r1, FOO ; load next location into r1
Slide 36
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•We use .DB to allocate code ROM memory locations for fixed data such as ASCII
string.
Slide 37
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•.ORG (origin)
•The .ORG directive is used to indicate the beginning of the address. It can be used for
both code and data.
•.INCLUDE directive
•The .include directive tells the AVR assembler to add the content of a file to our
program (like the #include directive in C language).
Slide 38
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Introduction to AVR Assembly ProgrammingIntroduction to AVR Assembly Programming
•We discuss Assembly language format and define some widely used terminology
associated with Assembly language programming.
•While the CPU can work only in binary, it can do so at a very high speed, however to
deal with 0’s and 1’s in order to program the computer.
•A program that consist of 0’s and 1’s is called machine language.
•In early days of the computer, programmers coded programs in machine language.
•Eventually, Assembly language were developed which provided mnemonics for
machine code instruction plus other feactures that made programming faster and less
to error.
•The term mnemonic is frequently used in computer science and engineering literature
to refer to code and abbreviation that are relatively easy to remember
Slide 39
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Structure of Assembly language
Slide 40
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Assembling an AVR programAssembling an AVR program
•The basic form of an Assembly language program has been given next question is :
How it is created, assembled, and made ready to run?
Slide 41
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
The Program Counter and Program ROM The Program Counter and Program ROM
Space in the AVRSpace in the AVR
•Program counter in the AVR
Slide 42
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 43
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 44
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 45
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Placing code in program ROM
•To get better understanding of the role of the program counter in fetching and
executing a program, we examine the action of the program counter as each
instruction is fetched and executed.
Slide 46
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 47
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•ROM width in the AVR
Slide 48
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Harvard architecture in the AVR
•AVR uses Harvard architecture, which means that there are separate buses for the
code and the data memory.
Slide 49
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 50
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Instruction Format
•LDI instruction formation
•ADD instruction formation
Slide 51
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•STS instruction formation
•LDS instruction formation
•IN instruction formation
Slide 52
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•OUT instruction formation
•JMP instruction formation
Slide 53
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
RISC Architecture in the AVRRISC Architecture in the AVR
•There are three ways available to microprocessor designers to increase the processing
power of the CPU:
•1. Increase the clock frequency of the chip. One drawback of this method at higher
frequency, the more power and heat dissipation.
•2. Use Harvard architecture by increasing the number of buses to bring more
information (code and data) into the CPU to be processed.
•3. Change the internal architecture of the CPU and use what is called RISC
architecture.
•Atmel used all three methods to increase the processing power of the AVR
microcontrollers.
Slide 54
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 55
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Features of RISC
•Feature 1
•Feature 2
Slide 56
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Feature 3
•RISC processor have small instruction set. RISC processor have only basic instruction
such as ADD, SUB, MUL, LOAD, STORE, AND, OR, EOR, CALL, JUMP, and so on.
•The limited number of instruction is one of the criticisms leveled at the RISC processor.
•Defender of CISC have called it “complete instruction set computer” instead of
“complex instruction set computer” because it has a complete set of every kind of
instruction.
•The limited number of instruction in RISC leads to programs that are large.
•Although these program can use more memory, this is not a problem because memory
is cheap.
•Feature 4
Slide 57
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Feature 5
•Feature 6
•Feature 7
Slide 58
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Questions and AnswersQuestions and Answers
END
Slide 59
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•Write a program to
•(a) place each of your 6 digit ID numbers into a
RAM location starting at address 0x100 (Starting
your ID from left to right)
•(b) add each digit to R22 and store the sum in
RAM location 0x306
Slide 60
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
Slide 61
www. Mi cro D igit al Ed. com
BIH E universit y
AVR Microcontroller and Embedded System Using Assembly and C
Mazidi, Naimi, and Naimi
© 2011 Pearson Higher Education,
Upper Saddle River, NJ 07458. • All Rights Reserved.
•LDI R16, 0x01
•LDI R17, 0x03
•LDI R18, 0x02
•LDI R19, 0x05
•LDI R20, 0x00
•LDI R21, 0x03
•STS 0x100, R16
•STS 0x101, R17
•STS 0x102, R18
•STS 0x103, R19
•STS 0x104, R20
•STS 0x105, R21
•LDI R22, 0x00
•ADD R22, R16
•ADD R22, R17
•ADD R22, R18
•ADD R22, R19
•ADD R22, R20
•ADD R22, R21
•STS 0X306, R22
Tags
Categories
General
Download
Download Slideshow
Get the original presentation file
Quick Actions
Embed
Share
Save
Print
Full
Report
Statistics
Views
93
Slides
61
Age
475 days
Related Slideshows
22
Pray For The Peace Of Jerusalem and You Will Prosper
RodolfoMoralesMarcuc
33 views
26
Don_t_Waste_Your_Life_God.....powerpoint
chalobrido8
36 views
31
VILLASUR_FACTORS_TO_CONSIDER_IN_PLATING_SALAD_10-13.pdf
JaiJai148317
33 views
14
Fertility awareness methods for women in the society
Isaiah47
30 views
35
Chapter 5 Arithmetic Functions Computer Organisation and Architecture
RitikSharma297999
29 views
5
syakira bhasa inggris (1) (1).pptx.......
ourcommunity56
30 views
View More in This Category
Embed Slideshow
Dimensions
Width (px)
Height (px)
Start Page
Which slide to start from (1-61)
Options
Auto-play slides
Show controls
Embed Code
Copy Code
Share Slideshow
Share on Social Media
Share on Facebook
Share on Twitter
Share on LinkedIn
Share via Email
Or copy link
Copy
Report Content
Reason for reporting
*
Select a reason...
Inappropriate content
Copyright violation
Spam or misleading
Offensive or hateful
Privacy violation
Other
Slide number
Leave blank if it applies to the entire slideshow
Additional details
*
Help us understand the problem better