AVR RISC Microcontroller Handbook -  Claus Kuhnel

AVR RISC Microcontroller Handbook (eBook)

(Autor)

eBook Download: PDF | EPUB
1998 | 1. Auflage
312 Seiten
Elsevier Science (Verlag)
978-0-08-049973-4 (ISBN)
Systemvoraussetzungen
Systemvoraussetzungen
62,95 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen
The AVR RISC Microcontroller Handbook is a comprehensive guide to designing with Atmel's new controller family, which is designed to offer high speed and low power consumption at a lower cost. The main text is divided into three sections: hardware, which covers all internal peripherals; software, which covers programming and the instruction set; and tools, which explains using Atmel's Assembler and Simulator (available on the Web) as well as IAR's C compiler. - Practical guide for advanced hobbyists or design professionals - Development tools and code available on the Web
The AVR RISC Microcontroller Handbook is a comprehensive guide to designing with Atmel's new controller family, which is designed to offer high speed and low power consumption at a lower cost. The main text is divided into three sections: hardware, which covers all internal peripherals; software, which covers programming and the instruction set; and tools, which explains using Atmel's Assembler and Simulator (available on the Web) as well as IAR's C compiler. - Practical guide for advanced hobbyists or design professionals- Development tools and code available on the Web

Front Cover 
1 
AVR Rise Microcontroller Handbook 4
Copyright Page 5
Table of Contents 6
Preface 10
CHAPTER 1. Some Basics 12
1.1 Architecture 12
1.2 Important Terms 16
1.3 Numbers 18
CHAPTER 2. Hardware Resources of AVR Microcontrollers 20
2. 1 Architectural Overview 20
2.2 The Arithmetic Logic Unit 24
2.3 Program and Data Memories 25
2.4 Peripherals 32
2.5 Reset and Interrupt System 68
2.6 Clock 71
CHAPTER 3. Handling the Hardware Resources 74
3.1 Memory Addressing Modes 74
3.2 Instruction Set 82
3.3 Reset and Interrupt Handling 123
3.4 Watchdog Handling 126
3.5 Stack 127
3.6 Program Constructs 131
3.7 Defensive Programming 138
CHAPTER 4. Development Tools 142
4.1 ATMEL AVR Assembler and Simulator 142
4.2 ATMEL A VR Studio 155
4.3 JAR Embedded Workbench EWA90 157
4.4 AVR Pascal from E-LAB Computers 166
4.5 AVR BASIC from Silicon Studio 177
4.6 Programmer and Evaluation Boards 179
CHAPTER 5. Example Programs 190
5.1 Example Programs in AVR Assembler 190
5.2 Example Program in C 272
5.3 Example Programs in AVR BASIC 276
Appendix A: Part Numbering System 284
Appendix B: Pin Configurations 286
Appendix C: Schematics of SIMMSTICK Modules 288
Appendix D: Register and Bit Definitions 292
Appendix E: Some Fundamentals of RS-232 
298 
Appendix F: Some Fundamentals of RS-422 and RS-485 304
Appendix G: 8-Bit Intel Hex File Format 308
Appendix H: Decimal-to-Hex-to-ASCII Converter 310
Appendix I: Overview of Atmel's Application Notes and Software 312
Appendix J: Literature 316
Appendix K: Contacts 318
Index 320

2

Hardware Resources of AVR Microcontrollers


As noticed in the preface, the AVR microcontroller family is based on a new RISC architecture. In order to optimize code size, performance, and power consumption, the AVR architecture has incorporated a large fast-access register file and fast single-cycle instructions. The fast-access RISC register file consists of 32 general-purpose working resisters. Traditional accumulator-based architectures require large amounts of program code for data transfers between the accumulator and memory. With these 32 working registers—each of which acts as an accumulator—in AVR microcontrollers, these data transfers are eliminated.

The AVR microcontroller prefetches an instruction during the previous instruction execution and then executes in a single cycle. In other CISC- and RISC-like architectures, the external oscillator clock is divided down (by as much as 12 times) to the traditional internal execution cycle. The AVR microcontrollers execute an instruction in a single clock cycle and are the first true RISC machines in the 8-bit market.

The AVR architecture supports a complete spectrum of price performance, from simple small-pin-count controllers such as the AT90S1200 on the low end, to high-range devices with large on-chip memories such as the AT90S8515

The Harvard-style architecture directly addresses up to 8 Mbytes of program memory and 8 Mbytes of data memory. The register file is dual mapped and can be addressed as part of the on-chip SRAM memory to enable fast context switching.

2.1 Architectural Overview


Two different CPU models are used in the AVR microcontroller family. Atmel’s part numbering system gives the required information about the CPU model used in the each microcontroller device (see the Appendix for reference).

Figures 2-1 and 2-2 show block diagrams of the AT90S1200 (low end) and the AT90S8515 (high end) microcontrollers

Figure 2-1 Block diagram of AT90S1200 microcontroller.

Figure 2-2 Block diagram of AT90S8515 microcontroller.

Comparing Figures 2-1 and 2-2, we can find many common factors and some differences.

In all members of the AVR microcontroller family, the fast-access register file concept contains 32 8-bit general-purpose working registers with a single-clock-cycle access time. This means that during one single clock cycle, one

ALU (arithmetic logic unit) operation is executed. Two operands are fetched from the register file, the operation is executed, and the result is stored back in the register file—all in one clock cycle of 50 ns minimum.

In CPU model 1, six of the 32 registers can be used as three 16-bit indirect address register pointers for SRAM addressing, enabling efficient address calculations. In CPU model 0, only two registers build a 16-bit register. One of the three address pointers is also used as the address pointer for the constant table lookup function. These added function registers are the 16-bit X-register, Y-register, and Z-register.

In addition to the register operation, the conventional memory addressing modes can be used on the register file as well. This is enabled by the fact that the register file is assigned the 32 lowermost SRAM addresses, allowing them to be accessed as though they were ordinary memory locations.

With the relative jump and call instructions, the whole 4K address space is directly accessed. All AVR instructions have a single 16-bit word format, meaning that every program memory address contains a single 16-bit instruction.

During interrupts and subroutine calls, the return address program counter (PC) is stored on the stack. The stack is effectively allocated in the general data SRAM, and consequently the stack size is only limited by the total SRAM size and the usage of the SRAM. All user programs must initialize the stack pointer (SP) in the reset routine (before subroutines or interrupts are executed). The 16-bit SP is read/write accessible in the I/O space.

The 256-byte data SRAM can be easily accessed through the four different addressing modes supported in the AVR architecture.

The I/O memory space contains 64 addresses for CPU peripheral functions such as control registers, timer/counters, A/D converters, and other I/O functions. The memory spaces in the AVR architecture are all linear and regular memory maps.

The organization of program and data memory for an AT90S8515 microcontroller is shown in Figure 2-3 as a memory map. The program memory is executed with single-level pipelining. While one instruction is being executed, the next instruction is prefetched from the program memory. This concept enables instructions to be executed in every clock cycle. Figure 2-4 shows the timing conditions for this single-level pipelining.

Figure 2-3 Memory maps for program and data memory for AT90S8515.

Figure 2-4 Parallel instruction fetch and execution.

A flexible interrupt module has its control registers in the I/O space with an additional global interrupt enable bit in the status register (SREG). All the different interrupts have a separate interrupt vector in the interrupt vector table at the beginning of the program memory. The different interrupts have priority in accordance with their interrupt vector position. The lower the interrupt address vector, the higher the priority.

2.2 The Arithmetic Logic Unit


The high-performance AVR ALU operates in direct connection with all 32 general-purpose working registers. As Figure 2-5 shows, ALU operations between registers in the register file are executed within a single clock cycle.

Figure 2-5 Single-cycle ALU operation.

The ALU operations are divided into three main categories—arithmetic, logic, and bit functions. Some microcontrollers in the AVR microcontroller family will feature a hardware multiplier in the arithmetic part of the ALU.

2.3 Program and Data Memories


The AVR microcontroller uses a Harvard architecture concept, with separate memories and buses for program and data.

2.3.1 Downloadable Flash Program Memory


The program memory is in-system downloadable flash memory. The flash memory space of all microcontrollers of the AVR family is explained in detail in the hardware chapter. The different access methods to the program memory are explained in Chapter 3, which describes the handling of the hardware resources.

2.3.2 SRAM Data Memory


The data address space is organized in a maximum of four groups. The lower 96 bytes are reserved for register file and I/O registers in all devices of the AVR microcontroller family.

Microcontrollers with SRAM between internal and external SRAM will be distinguished. Figure 2-6 explains the organization of SRAM in an AT90S8515, for example. The parts of SRAM not available in all devices of the AVR microcontroller family are grayed. Microcontrollers have internal SRAM and can have external SRAM for enhancement. Between these both types must distinguished.

Figure 2-6 SRAM organization.

An access to the external SRAM occurs with the same instructions as for internal data SRAM access. When the internal data SRAM is accessed, the read and write strobe pins (/RD and /WR) are inactive during the whole access cycle. The external data SRAM physical address locations corresponding to the internal data SRAM addresses cannot be reached by the CPU. External SRAM operation is enabled by setting the SRE bit in the MCUCR register.

The PortA and PortC pins have alternative functions related to the optional external data SRAM. PortA can be configured to be the multiplexed low-order address/data bus during accesses to the external data memory, and PortC can be configured to be the high-order address byte.

Figure 2-7 shows read and write access to external SRAM without wait states.

Figure 2-7 External data SRAM memory cycle without wait state.

2.3.3 General-Purpose Register File


Figure 2-8 shows the structure of the general-purpose registers file in the CPU.

Figure 2-8 General-purpose register file.

All register operations have direct and single-cycle access to all registers. The only exceptions are the five constant arithmetic and logic instructions SBCI, SUBI, CPI, ANDI, and ORI between a constant and a register, and the LDI instruction for load immediate constant data. These instructions apply only to the registers R16..R31.

As shown in Figure 2-8, each register is also assigned a data memory address, mapping them directly into the first 32 locations of the user SRAM area. Although they are not physically implemented as SRAM locations, this memory organization provides great flexibility in access of the registers, as the X,Y, and Z registers can be set to index any register in the file for CPU...

Erscheint lt. Verlag 2.10.1998
Sprache englisch
Themenwelt Informatik Theorie / Studium Compilerbau
Informatik Weitere Themen Hardware
Technik Elektrotechnik / Energietechnik
ISBN-10 0-08-049973-2 / 0080499732
ISBN-13 978-0-08-049973-4 / 9780080499734
Haben Sie eine Frage zum Produkt?
PDFPDF (Adobe DRM)
Größe: 46,1 MB

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

EPUBEPUB (Adobe DRM)
Größe: 24,8 MB

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
An In-Depth Guide to the Spring Framework

von Iuliana Cosmina; Rob Harrop; Chris Schaefer; Clarence Ho

eBook Download (2023)
Apress (Verlag)
62,99