The AVR microcontroller is a RISC microcontroller introduced by Atmel in 1997.
RISC (Reduced Instruction System Computer) is relative to CISC (Complex Instruction System Computer).
RISC is not simply to reduce the number of instructions, but rather to increase the speed of operation by making the structure of the computer simpler and more rational.
RISC prioritizes simple instructions, avoiding complex instructions, and fixing the width of instructions to reduce the variety of instruction formats and addressing methods, thus shortening the instruction cycle and increasing the speed of operation. RISC prioritizes simple instructions that are used most frequently and avoids complex instructions, and fixes the width of instructions to reduce the variety of instruction formats and addressing modes, thus shortening the instruction cycle and increasing the operation speed. The RISC structure of the AVR enables the AVR series of microcontrollers to have a high speed processing capability of 1 MIPS/MHz (millions of instructions per second per megahertz).
Early microcontroller mainly due to the process and design level is not high, high power consumption and poor anti-jamming performance and other reasons, so take the safe program: that is, the use of higher frequency division coefficients on the clock frequency division, so that the instruction cycle is long, the execution of the slow speed. Although the later CMOS microcontroller to improve the clock frequency and reduce the crossover coefficient and other measures, but this state has not been completely changed (51 as well as 51-compatible). In the meantime, although there are some compact instruction set microcontroller (RISC) came out, but still follow the clock frequency division of the practice.
The introduction of AVR microcontroller completely breaks this old design pattern, abolishes the machine cycle, abandons the complex instruction computer (CISC) to pursue the practice of complete instructions; adopts the streamlined instruction set, takes the word as the unit of instruction length, and arranges the content-rich operands and opcodes in a word (the majority of the single-cycle instructions in the instruction set are like this), and takes a short period of time to fetch instructions, which can be pre-fetched to realize the flow of instructions. The instruction cycle is short, and the instruction can be pre-fetched to realize the flow operation, so the instruction can be executed at high speed. Of course, this leap in speed is backed by high reliability.
AVR microcontroller hardware structure to take the 8-bit machine and 16-bit machine compromise strategy, that is, the use of local registers to store the stack (32 register file) and the monolithic high-speed input/output program (that is, the input capture register, the output of the comparative matching registers and the corresponding control logic). Improved instruction execution speed (1Mips/MHz), overcoming the bottleneck phenomenon, enhanced functionality; at the same time, it reduces the overhead of peripheral management, relatively simplifies the hardware structure and reduces the cost. Therefore, AVR microcontroller in the software/hardware overhead, speed, performance and cost of many aspects of the optimization of the balance, is a cost-effective microcontroller.
The AVR MCU is embedded with high quality Flash program memory, which is easy to erase and write, and supports ISP and IAP, making it convenient for product debugging, development, production, and updating. The embedded long-life EEProm can save the key data for a long time to avoid power loss.
The on-chip high-capacity RAM not only meets the needs of general-purpose applications, but also more effectively supports the use of high-level language to develop system programs, and can be used to expand external RAM like MCS-51 microcontrollers.
The I/O lines of the AVR microcontroller are all equipped with programmable pull-up resistors, which can be individually configured as inputs/outputs and can be set to set up (initially) a high-impedance input with a high drive capacity (which can be eliminated), making the system a perfect fit for a wide range of applications. With features such as power driver, the I/O ports are flexible, powerful, and fully utilizable.
The AVR microcontroller has a variety of independent clock dividers for URAT, I2C, and SPI. The 8/16-bit timer has a 10-bit prescaler, which can be set by software to provide a wide range of timing options.
AVR microcontroller unique "timer/counter (single) bidirectional counting to form a triangle wave, and then with the output comparison with the matching register to generate a variable duty cycle, variable frequency, phase variable square wave design method (i.e., pulse width modulation output PWM) is more refreshing.
Enhanced high-speed synchronous/asynchronous serial port with hardware generated parity code, hardware detection and parity error detection, two-stage receive buffer, baud rate automatic adjustment positioning (when receiving), shielding of data frames, etc., to improve the reliability of the communication, easy to write the program, and more convenient for the formation of a distributed network and the realization of multi-machine communication system for complex applications, the serial port function is much more than the MCS-51/96 The serial port function is much more than the serial port of MCS-51/96 microcontroller, plus the high speed of AVR microcontroller, short interrupt service time, so it can realize the high baud rate communication.
The byte-oriented high-speed hardware serial interface TWI, SPI. TWI is compatible with the I2C interface, with ACK signal hardware transmission and recognition, address recognition, bus arbitration and other functions, to achieve the master/slave receive/transmit all the four combinations of multi-machine communication. SPI supports four combinations of multi-computer communication, such as master/slave.
AVR microcontroller has automatic power-on reset circuit, independent watchdog circuit, low voltage detection circuit BOD, multiple reset sources (automatic power-on and power-off reset, external reset, watchdog reset, BOD reset), and a programmable delayed running program after startup, which enhances the reliability of the embedded system.
AVR microcontroller has a variety of power-saving hibernation mode, and can be wide voltage operation (5-2.7V), anti-interference ability, can reduce the general 8-bit machine in the software anti-interference design workload and the use of hardware.
Selection of AVR series microcontrollers
AVR series microcontrollers are complete and can be applied to a variety of different occasions.
There are 3 grades of AVR microcontrollers:
Low-grade Tiny series: mainly Tiny11/12/13/15/26/28, etc.
Mid-grade AT90S series: mainly AT90S1200/2313/8515/8535, etc.; (are being phased out or transitioned to the Mega)
High-grade ATmega: mainly ATmega8/16/32/64/128 (memory capacity of 8/16/32/64/128KB) and ATmega8515/8535, etc..
AVR device pins from 8 to 64 pins, there are a variety of different packages to choose from. The letter immediately following the ⒈ model number indicates the voltage operating range. With "V": 1.8-5.5V; if default, without "V": 2.7-5.5V.
Example: ATmega48-20AU, without "V " indicates an operating voltage of 2.7-5.5V.
The numeric portion of the peal suffix indicates the highest system clock supported.
Example: ATmega48-20AU, "20" means it can support up to 20MHZ system clock.
3 The first (second) letter of the suffix indicates the package. "P": DIP package, "A": TQFP package, "M": MLF package.
Example: ATmega48-20AU, "A" indicates TQFP package.
Sung the last letter of the suffix, it means the application level. "C": Commercial Grade, "I": Industrial Grade (Leaded), "U" Industrial Grade (Lead Free).
Example: ATmega48-20AU, "U" means lead-free industrial grade. ATmega48-20AI, "I" means leaded industrial grade. The control core of the system module is AVR high-speed microcontroller ATmega8. AVR microcontroller is a new generation of high-speed RISC microcontroller based on Harvard structure, featuring fast speed, low price, high reliability, strong I/O port line drive capability and rich resources of on-chip integrated peripherals, etc., and its internal integration of ISP downloadable programmable Flash, EEPROM, fusible bit and lock bit. The AVR microcontroller's ISP download cable is simple and inexpensive, and is supported by free download software (e.g., PonyProg). The PDIUSBD12 is a cost-effective USB interface device that is fully compliant with the USB 1.1 specification and is easy to interface to a variety of microprocessors.
The circuit connection between the system module AVR microcontroller and PDIUSBD12 is shown in Figure 1.
As seen in Figure 1, because of the high speed of the AVR microcontroller, the I/O port lines can be used to simulate the timing of the PDIUSBD12 in a software way to read and write to it. This approach allows flexible control of the PDIUSBD12's timing and address according to different microprocessor speeds without the need for decoding circuits, thus simplifying hardware design and reducing costs.
Because of the ATmega8 on-chip integrated UART, SPI, I2C and other interfaces, the interface module can use these interfaces to communicate with other systems, making the interface module a universal interface converter. Its system hardware structure block diagram is shown in Figure 2. AVR has been widely used: air conditioning control board printer control board smart meter smart flashlight LED control screen medical equipment GPS