What are the advantages and disadvantages of pic microcontroller and AVR microcontroller?

Last Update Time: 2019-10-15 09:56:06

Analysis of advantages and disadvantages of PIC microcontroller

image.png

The PIC microcontroller CPU adopts the RISC structure, with 33, 35, and 58 instructions respectively (depending on the level of the microcontroller), which is a reduced instruction set. The 51 series has 111 instructions, and the AVR microcontroller has 118 instructions, which are more complicated than the former. It adopts Haryard dual bus structure and runs fast (instruction cycle is about 160~200nS). It can make program memory access and data memory access parallel processing. This instruction pipeline structure completes two parts in one cycle. Execution of the instruction, the second is to take the next instruction from the program memory, so that it seems that each instruction only needs one cycle (except for individual), which is one of the reasons for efficient operation. In addition, it features low operating voltage, low power consumption, and high drive capability.

 

The I/O ports of the PIC series MCUs are bidirectional, and their output circuits are CMOS complementary push-pull output circuits. The I/O pin adds a direction register for setting the input or output state, which solves the same state of input and output when the 51 series I/O pin is high. When set to 1, it is the input state, and regardless of whether the pin is high or low, it is in a high-impedance state; when it is set to 0, it is an output state, regardless of the level of the pin, it is in a low-resistance state,  has a considerable driving capacity, low-level suction current up to 25mA, high-level output current up to 20mA. Compared with the 51 series, this is a big advantage, it can directly drive the digital tube display and the external circuit is simple. Its A/D is 10 bits, which can meet the accuracy requirements. With online debugging and programming capabilities.

 

The special registers of this series of microcontrollers are not concentrated in a fixed address range (80 ~ FFH) like the 51 series, but are scattered in four address ranges, that is, bank 0 (Bank0: 00-7FH), Bank 1 (Bank1: 80-FFH), Bank 2 (Bank 2: 100-17FH), Bank 3 (Bank3: 180-1FFH). Only five dedicated registers, PCL, STATUS, FSR, PCLATH, and INTCON, appear simultaneously in four banks. In the programming process, it is indispensable to deal with the special register, and the corresponding bank is repeatedly selected, that is, the sixth bit (RP1) and the fifth bit (RPO) of the status register STATUS are set or cleared. This somewhat brings some trouble to programming. For the above-mentioned single-chip microcomputer, its bit instruction operation is usually limited to the bank 0 interval (00 to 7FH). The data transfer and logic operations are basically performed by the working register w (equivalent to the accumulator A of the 5l series), and the 51 series can also be directly transferred between the registers (eg, MOV30H, 20H; register 20H) The content is directly transferred to the register 30H), so the bottleneck phenomenon of the PIC microcontroller is more serious than the 51 series, which is very interesting in programming.

 

In summary, the PIC microcontroller should have three main features:

 (1) Pipeline structure: The instruction and execution of MCS-51 MCU adopts single instruction pipeline structure, that is, take one instruction, and then take one instruction after execution; and PIC takes instruction and execution adopts dual instruction pipeline structure, when one When the instruction is executed, the next instruction is allowed to be fetched at the same time, thus implementing a single-cycle instruction.

 

(2) Bus structure: The bus structure of MCS-51 MCU is von Neumann type. The computer fetches instructions and data in the same storage space. The two can't be simultaneously; the bus structure of PIC MCU is Harvard structure, instruction and The data space is completely separate, one for instructions and one for data, which increases data throughput because it allows simultaneous access to programs and data. Because the Harvard dual bus architecture is used in PIC microcontrollers, the difference from common microcontrollers is that the program and data buses can be of different widths. The data bus is 8-bit, but the instruction bus bits are 12, 14, and 16 bits, respectively.

 

(3) Register group: All registers of PIC microcontroller, including I/O port, timer and program counter, all adopt RAM structure, and only need one instruction cycle to complete access and operation; MCS-51 microcontroller needs Two or more cycles can change the contents of the register.

Analysis of advantages and disadvantages of AVR single chip

image.png

The outstanding features of AVR microcontrollers are high performance, high speed and low power consumption. It cancels the machine cycle and executes the pipeline operation with the clock cycle as the instruction cycle. AVR microcontroller instructions are in word units, and most of the instructions are single-cycle instructions. The single cycle can perform the function of this instruction and complete the reading of the next instruction. A total of 32 general-purpose registers (RO-R31), the first 16 registers (R0 ~ R15) can not directly deal with the immediate, so the versatility has decreased. In the 5l series, all of its general-purpose registers (address 00-7FH) can directly deal with immediate data, which is obviously better than the former.

 

The AVR series does not have a structure similar to the accumulator A. It mainly implements the function of A through the R16 to R31 registers. In the AVR, there is no data pointer DPTR like the 5l series, but three 16-bit registers from X (composed of R26, R27), Y (composed of R28, .R29), and z (consisting of R30, R31). Complete the function of the data pointer (equivalent to three sets of DPTR), and can also be used for post-increment or first-decrease operation.

 

In the 51 series, all logic operations must be done in A; the AVR can be done between any two registers, eliminating the need to toss back and forth in A, which is stronger than the 51 series.

 

The AVR's dedicated registers are concentrated in the $00 to $3F address range. There is no need to select the bank as the PIC, which is more convenient to use than PIC. AVR's on-chip RAM address range is $0060 ~ $00DF (AT90S23131) and $0060 ~ $025F (AT90S85l5, AT90S8535), they occupy the address of the data space, these on-chip RAM is only used to store data, usually not Has the function of a general purpose register. When the program is complicated, the general-purpose registers R0-R31 are not enough; while the 51-series has up to 128 general-purpose registers (four times that of the AVR), there is no such feeling when programming.

 

The AVR's I/O pin is similar to the PIC. It also has a direction register for controlling the input or output. In the output state, the high-level output current is about 10mA, and the low-level sink current is 20mA. Although not as good as PIC, it is stronger than the 51 series.

 

If you want to know more, our website has product specifications for pic microcontroller and AVR microcontroller, you can go to ALLICDATA ELECTRONICS LIMITED to get more information