The following summarizes the main features of the AVR microcontroller ATmega16:
(Note: Red *x* symbols in brackets indicate that there will be explanations/explanations below the article)
1) AVR core microcontroller with RISC structure.
131 machine instructions, most of which are executed in a single system clock cycle;
32 8-bit general-purpose working registers;
Fully static operation mode (Fully Static Operation). (*A*)
It has 16 MIPS performance when operating at 16 MHz. (Note: The maximum operating frequency of the ATmega16L series is 8 MHz);
There is a 2-clock-cycle hardware multiplier inside.
2) On-chip large capacity, non-volatile program and data memory (*B*)
16KB In-System Programming (ISP) Flash program memory (erase and write times > 10 000), using Boot load technology to support IAP (In-Application Programming) function.
1KB on-chip SRAM data memory, which can realize 3-level locked program encryption;
512 bytes of on-chip ISP EEPROM data memory (number of shoe shines > 100 000);
3) On-chip JTAG interface
Supports boundary scan function compliant with JTAG standard (compatible with IEEE 1149.1 standard) for chip detection;
Support extended on-chip online debugging function;
The on-chip Flash, EEPROM, fuse bits and encryption lock bits can be downloaded and programmed through the JTAG interface; (*C*)
4) Peripheral interface
2 8-bit timer/counters with independent and programmable prescaler;
1 16-bit timer/counter with programmable prescaler, compare and capture functions;
Real-time clock RTC with independent oscillator on chip;
4 PWM channels;
8-channel 10-bit ADC;
Byte-oriented two-wire interface TWI (Two-Wire Serial Interface, fully compatible with IIC bus hardware interface);
1 programmable, enhanced full-duplex, serial interface USART supporting synchronous/asynchronous communication;
1 SPI (Serial Peripheral Interface Bus) serial interface that can work in master/slave mode (supports ISP program download);
On-chip integrated analog comparator; (*D*)
The chip contains a programmable watchdog timer WDT with independent on-chip oscillation period;
5) Other features
Contains power-on reset circuit and programmable power-off detection reset circuit BOD (Brown-out Detection);
The chip contains a 1/2/4/8 MHz calibrated, correctable RC oscillator that can be used as the system clock;
21 internal and external interrupt sources; (*E*)
6 sleep modes (idle mode, ADC noise suppression mode, power saving mode, power down mode, standby mode and
Extended Standby mode), supports power saving mode;
32 programmable I/O ports. Package options include: 40-pin PDIP package, 44-pin TQFP package, and 44-pin MLF package; (*F*)
Working voltage: 2.7~5.5V for ATmega16L, 4.5~5.5V for ATmega16;
Operating speed: 0~8MHz for ATmega16L, 0~16MHz for ATmega16;
Power consumption index: When ATmega16L works at 1MHz, 3V, 25 degrees Celsius: the typical power consumption is 1.1mA, the idle mode is 0.35mA, and the power-down mode is < 1uA;
Note A:
The full static working mode means that the clock stops oscillating (and the manual also says that the working frequency is 0~8/16MHz), but the data in the register and data memory (ATmega16 uses SRAM memory, so there is no need for regular refresh) will not be lost. The premise is that your power supply must exist, otherwise it will shut down, right?
Note B:
The Flash program memory space of Atmega16 microcontroller can be divided into two sections: Boot Program Section and Application Program Section. The read/write protection of the two sections can be achieved by setting the corresponding lock bits. In the boot program residing in the boot program section, the SPM instruction can be used to implement the write operation to the application segment (that is, to implement the IAP function so that the system can update the system program automatically). In AVR, all storage spaces are linear. SRAM can be accessed through 6 different addressing modes. (They are: direct/indirect addressing of data memory space, register indirect addressing of data memory space with post-increment/pre-decrement, register indirect addressing of data memory space with displacement, and SP indirect addressing of data memory space stack register).
Note C:
The fuse is a design to protect intellectual property rights. By adding voltage to a specific pin and sufficient current, the fuse inside can be blown (the fuse of AVR can be programmed multiple times, not OTP fuse). After it is blown, the program in the chip cannot be read out or rewritten, and can only be used to run. By setting and configuring the fuse bits of the AVR microcontroller, we can make the AVR have a functional combination with different characteristics, which is more suitable for practical use and learning. The setting values of different fuse bits are different when leaving the factory. Be sure to distinguish them. The configuration of the fuse bits is very important in the AVR microcontroller. Improper configuration may lock the microcontroller or malfunction; before configuration, be sure to check and align carefully with the datasheet manual; be sure to post a blog to summarize and learn.
Note D:
A comparator is an electronic component that outputs different voltage results at the output end by comparing the current or voltage at two input ends. Comparators are often used in analog-to-digital conversion circuits. Using the analog comparator of AVR can form an ADC converter; after the AVR microcontroller is reset, the analog comparator is in a working state. If it is not used, set the ACD bit of the register ACSR to 1 to turn off the analog comparator to reduce power consumption; the registers related to it are SFIOR and ACSR. The analog comparator of AVR is one of the interrupt sources of AVR;
Note E:
The 21 internal and external interrupt sources are (in order of priority):
AVR MCU interrupt vector area vector number Flash space address interrupt source
Interrupt Definition
1 $000RESET Reset caused by external pin level, power-on reset, power-off detection reset,
Watchdog reset, JTAG AVR reset 2 $002INT0 External interrupt 0 3 $004INT1 External interrupt 1 4 $006TIMER 2 COMP Timer/Counter 2 Compare match 5 $008TIMER 2 OVF Timer/Counter 2 Overflow 6 $00ATIMER 1 CAPT Timer/Counter 1 Event Capture 7 $00CTIMER 1 COMPA Timer/Counter 1 Compare match A 8 $00ETIMER 1 COMPB Timer/Counter 1 Compare match B 9 $010TIMER 1 OVF Timer/Counter 1 Overflow 10 $012TIMER 0 OVF Timer/Counter 0 Overflow 11 $014SPI STCSPI Serial transfer ends 12 $016USART RXCUSART, Receiving ends 13 $018USART UXREUSART, Data register empty 14 $01AUSART TXCUSART, Sending ends 15 $01CADCA/C Conversion ends 16 $01EEE_RDYEEPROM ready 17 $020ANA_COMP analog comparator 18 $022TWI two-wire serial interface 19 $024INT2 external interrupt request 2 20 $026TIMER 0 COMP timer/counter 0 compare match 21 $028SPM_RDY save program memory content ready
Interrupt vector area size = number of interrupt sources x number of words occupied by each interrupt vector
Interrupts are divided into maskable interrupts and non-maskable interrupts (reset is the only non-maskable interrupt in AVR).
Note F:
The AVR microcontroller has 32 I/O ports, which are divided into 4 groups of ports, each with 8 ports. The first function of the 4 ports is a general bidirectional I/O port, and each bit must be set as an independent input/output port through instructions. When set as input, it has internal pull-up resistors, which can be set to valid or invalid through programming. When the output is high, it can output 20mA of current, and when the output is low, it can absorb 40mA of current. Therefore, AVR can directly drive digital tubes and LED light-emitting diodes. Another thing to note is that after the AVR chip is reset, all I/O ports are defaulted to input mode, and the pull-up resistor is invalid, that is, the I/O is in the three-state state of input high impedance. The I/O space is a continuous 64 I/O register space, which corresponds to the control and data register addresses of each peripheral function of the microcontroller. The I/O register space can be directly accessed using the I/O register access instruction, or it can be mapped to the data memory space after the general working register group and operated using the data memory access instruction. The mapping address of I/O register space in data memory space is $020--&05F.
The following figure is the internal structure diagram of the AVR microcontroller:
Previous article:How to use Arduino system board to program microcontroller
Next article:Design of tire inner diameter measurement system based on AVR microcontroller
Recommended ReadingLatest update time:2024-11-16 19:38
- Popular Resources
- Popular amplifiers
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
- South Korea LG 28G Transceiver AiP Antenna 5G Application
- Reading Notes on the Good Book "Operational Amplifier Parameter Analysis and LTspice Application Simulation" 02 DC Bias
- Does anyone know how to initialize the input capture function of GD32?
- EEWORLD University ---- SPICE teaching video based on Ispice and Hspice (Yuan Ze University)
- Breaking news! Chinese scientists develop the world's largest brain-like computer with the largest number of neurons, with a brain capacity comparable to that of a mouse
- [Homemade] 8A high power adjustable power supply
- Design of an intelligent water quality detector based on Gizwits Cloud
- 【ufun learning】Learning 5: "Basic Example 4 - USB Serial Port and PC Communication"
- [Sold] ST P-NUCLEO-IHM001 Brushless Motor Development Kit for Sale
- Among so many board games articles, which one do you like best?