AVR microcontroller basics

Publisher:和谐相伴Latest update time:2011-02-27 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Basic knowledge of AVR microcontrollers
Features of AVR microcontrollers:
Microcontrollers are currently classified into 4-bit, 8-bit, 16-bit, and 32-bit according to the processing power of the CPU. The higher the number of bits, the stronger the data processing capability and instruction system of the microcontroller. AVR, 51, and PIC are all 8-bit machines. 8-bit microcontrollers are also the most widely used microcontrollers at present, and they can be seen in various fields.
AVR microcontrollers are a new type of 8-bit microcontrollers developed by ATMEL in 1997. AVR microcontrollers are divided into the low-end ATtiny series, the mid-range AT90S series, and the high-end ATmega series. This site recommends that beginners choose to learn the chip model ATmega48/88/168 or ATmega16; the mid-range AT90S series is not recommended because they are relatively early products and they have been discontinued.
All models of AVR microcontrollers (except some old models) support ISP online programming (burning), and the chip can be repeatedly erased and written, which makes learning AVR very convenient. Designers can program and debug the chip directly on the target circuit board through the download line, without having to put the chip on a dedicated programmer or emulator for burning and debugging.
Some models of 51 microcontrollers also support ISP online programming, such as AT89S51, AT89S52, etc. PIC microcontrollers also partially support ISP, but many of its models are burned once by OPT, which really makes it difficult for beginners.

Compared with 51 and PIC microcontrollers, AVR has a series of advantages, which are mainly reflected in the following aspects in popular terms:
1. AVR runs the fastest under the same system clock;
2. The FLASH and EEPROM memories of all AVR microcontrollers can be repeatedly burned and written, and support ISP online programming (burning), and the entry cost is very low;
3. The chip integrates multiple frequency RC oscillators, power-on automatic reset, watchdog, startup delay and other functions, making circuit design very simple;
4. Each IO port can output strong high and low levels when used as output, and the IO port can be high impedance or with pull-up resistors when used as input;
5. The chip has rich and practical resources, such as AD analog-to-digital device, DA analog-to-digital device, rich interrupt sources, SPI, USART, TWI communication port, PWM, etc.;
6. The chip adopts advanced data encryption technology, which greatly increases the difficulty of cracking;
7. The on-chip FLASH space is large and there are many varieties. The pins are as few as 8 pins and as many as 64 pins.
8. The pins of some chips are compatible with the 51 series, which is easy to replace. For example, ATtiny2313 is compatible with AT89C2051, ATmega8515/162 is compatible with AT89S51, etc.

Basic conditions for developing AVR microcontrollers:
1: A download cable (burner/programmer), the common ones are "parallel port AVRISP download cable" and "AVRISP/STK500 download cable";
2: A set of download cable control software;
3: A set of development software for compiling program code (can use C language or assembly language);
4: A test board;
5: A computer.

Introduction to download cable:
The download cable is what we commonly call "burner" or "programmer". In the AVR field, it is generally called AVRISP download cable. Different download cables have different ways of connecting to computers. Generally, there are parallel ports, serial ports and USB interfaces.
The advantages of the parallel port AVRISP download cable are low price and simple structure. It contains a 74HC244 chip and several resistors and capacitors. The disadvantages are that it is large in size and needs to occupy a parallel port of a printer. The parallel port download cable itself does not need to be upgraded. The version of the control software is different, and the chips and functions it adapts to are also different. The control software generally uses the SL-ISP software of Ssangyong Electronics, which has a Chinese interface and is easy to operate.
The AVRISP download cable with serial and USB interfaces generally integrates an AVR microcontroller as the control chip. The most common chip is ATMEGA8535. By upgrading the program version of this chip and the program version of the control software, it can adapt to different models of AVR microcontrollers. The difference between the serial port and the USB port is that the USB interface download cable has an additional USB to serial port chip. There are many software that support serial and USB port download cables. General AVR compilation software supports them, such as CodeVisionAVR (referred to as CVAVR), AVR Studio, IAR, etc. Unfortunately, there is no easy-to-use Chinese interface software to support it so far.

Introduction to the development software for compiling program code:

Software
Introduction to
AVR Studio
AVR official ATMEL company's free software, assembly language, integrating software and hardware simulation, debugging, and downloading
WinAVR
GCC language, its advantages are free
ATmanAVR
GCC language, its advantages are Chinese interface, integrated AVR Studio soft simulator, engineering wizard, shared software
IAR
C language, shared software, very expensive!
ICCAVR
C language, shared software, I heard that the amount of code generated is slightly larger
FASTAVR
Basic syntax, shared software. Integrates more commonly used peripheral device operation functions, simple and easy to learn
BASCOM-AVR
Basic syntax, shared software. It integrates the operation functions of many commonly used peripheral devices, is simple and easy to learn, and integrates simulation, download and burn. It is worth mentioning that its help file integrates many examples.
CodeVisionAVR
is referred to as CVAVR
C language, shared software, an excellent AVR microcontroller C compiler, easy to get started It
integrates the operation functions of many commonly used peripheral devices, supports most AVR chips, supports bit variables, and is similar in style to Keil C51.
It integrates serial/parallel ports, AVRISP and other download and burn functions
It integrates a powerful code generation wizard recommended

Notes
For amateur electronics enthusiasts who are amateur programmers and have no MCU foundation, BASCOM-AVR is recommended as the entry-level software; for beginners who already have some MCU foundation or really want to learn AVR MCU, CVAVR is recommended as the entry-level software; whether it is CVAVR, IAR, AVRGCC, ICCAVR, etc., their syntax is similar, and their principle is to convert the source code into assembly code first, and then the AVR assembly compiler compiles it into the final machine code; but they have their own characteristics and differences, so it is a wise choice to choose the simple and easy-to-learn CVAVR as the entry-level software. The final machine code is generally a hex file or a binary bin file

Reference address:AVR microcontroller basics

Previous article:Development of digital controlled constant current source based on PWM function of AVR microcontroller
Next article:Design of electronic ballast based on AVR 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号