ATmega168 Core Introduction

Publisher:legend9Latest update time:2021-12-13 Source: eefocusKeywords:ATmega168 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This section discusses the structure of the ATmega168 AVR core in general. The main task of the CPU is to ensure the correct execution of the program. Therefore, it must be able to access memory, perform operations, control peripherals, and handle interrupts.


(Click on the image to enlarge)

Figure 3. Block diagram of AVR architecture
To achieve the highest performance and parallelism, AVR uses Harvard architecture with independent data and program buses. Instructions in the program memory are executed through a one-stage pipeline. The CPU reads the next instruction while executing one instruction (called prefetch in this article). This concept enables single-clock cycle execution of instructions. The program memory is FLASH that can be programmed in-circuit. The 

fast access register file includes 32 8-bit general-purpose working registers with an access time of one clock cycle. This enables single-clock cycle ALU operation. In a typical ALU operation, two operands in the register file are accessed simultaneously, then the operation is performed, and the result is sent back to the register file. The entire process takes only one clock cycle.

There are 6 registers in the register file that can be used as 3 16-bit indirect addressing register pointers to address the data space, realizing efficient address operations. One of the pointers can also be used as an address pointer for the program memory lookup table. These additional function registers are the 16-bit X, Y, and Z registers.

The ALU supports arithmetic and logic operations between registers and between registers and constants. The ALU can also perform single register operations. After the operation is completed, the contents of the status register are updated to reflect the result of the operation.

Program flow is controlled by conditional/unconditional jump instructions and call instructions, which directly address the entire address space. Most instructions are 16 bits long, that is, each program memory address contains a 16-bit or 32-bit instruction.

The program memory space is divided into two areas: the boot area and the application area. Both areas have special lock bits to implement read and read/write protection. The SPM instruction used to write to the application area must be located in the boot area.

The program counter (PC) for the return address during interrupts and subroutine calls is saved on the stack. The stack is located in the general data SRAM, so its depth is only limited by the size of the SRAM. In the reset routine, the user must first initialize the stack pointer SP. This pointer is located in the I/O space and can be read and written. The data SRAM can be accessed through 5 different addressing
modes .

The AVR memory space is a linear planar structure.

The AVR has a flexible interrupt module. The control registers are located in the I/O space. The status register has a global interrupt enable bit. Each interrupt has an independent interrupt vector in the interrupt vector table. The priority of each interrupt is related to its position in the interrupt vector table. The lower the interrupt vector address, the higher the priority.

I/OI/O memory 64 directly addressable addresses, as control registers for CPU peripherals, SPI, and other I/O functions. Mapped to data 0x20 - 0x5F. In addition, ATmega168 has an extended I/O space located at SRAM address 0x60 - 0xFF, which can only be accessed using ST/STS/STD and LD/LDS/LDD instructions.

Keywords:ATmega168 Reference address:ATmega168 Core Introduction

Previous article:ATmega168 ALU
Next article:ATmega168 Pin Functions

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号