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.
Previous article:ATmega168 ALU
Next article:ATmega168 Pin Functions
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Research on the information performance advantages of Suruide in-vehicle Ethernet hardware and applications
- [Synopsys IP Resources] Prototyping as a Service (PaaS): Breaking through chip design process bottlenecks and simplifying the path to innovation
- How to write the test bench file for the verliog10 divider
- [Xianji HPM6750 Review] + Environment Setup Test
- EEWORLD University ---- Webinar: Thermal Monitoring and Protection
- How to solve the power supply ripple
- 【AT-START-F425 Review】No.06 Driving Segment LCD
- Today at 10:00 AM Award-winning live broadcast: STMicroelectronics SiC products and industrial application guide
- Gossip negative feedback
- Do you think domestic regulators will prevent Nvidia from acquiring ARM?