Characteristics and internal structure analysis of ATmega16 microcontroller

Publisher:悠闲之旅Latest update time:2020-01-20 Source: elecfansKeywords:ATmega16 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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:

Characteristics and internal structure analysis of ATmega16 microcontroller

Keywords:ATmega16 Reference address:Characteristics and internal structure analysis of ATmega16 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

How to interface Hall sensor using AVR microcontroller ATmega16
The working principle of the Hall sensor is based on the Hall effect proposed by Edwin Hall in 1869. The proposed statement says: "The Hall effect is the production of a voltage difference (the Hall voltage) across an electrical conductor, transverse to the current in the conductor and an applied magnetic field perpen
[Microcontroller]
How to interface Hall sensor using AVR microcontroller ATmega16
Atmega16 based voltage meter production program + schematic diagram
The attached proteus design diagram and circuit diagram are in the attachment   /***************************************************** Project :  Version :  Date    : 2015-10-29 Author  :tengzaiba Chip type               : ATmega16 AVR Core Clock frequency: 8.000000 MHz ************************************************
[Microcontroller]
Atmega16 based voltage meter production program + schematic diagram
Using 89S51 to Make a Simple Parallel Programmer ATmega16
;**************************ATmega16(L) Simple Parallel Programmer**********************/  ;Description:  ;For friends who have not programmed ATmega16 parallel programmer, engineers who first used ATmega16 may  write wrong fuse bits and encryption bits during serial programming, which makes serial programming unusable
[Microcontroller]
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号