Pic microcontroller is used frequently in daily life, and 5 1 microcontroller has the same status as pic microcontroller, so what is the difference between pic microcontroller and 5 1 microcontroller?
1, bus structure difference
The bus structure of 5 1 single chip microcomputer is von Neumann type, and the computer takes instructions and data in the same storage space, and they cannot be carried out at the same time; The bus structure of PIC microcontroller is Harvard structure, and the instruction and data space are completely separated, one is instruction and the other is data. Because programs and data can be accessed at the same time, the data transmission efficiency is improved. Just because PIC series single chip microcomputer adopts Harvard double bus structure, it is different from ordinary microcontroller in that the program and data bus can adopt different widths. The data bus is 8 bits, but the bits of the instruction bus are 12, 14 and 16 respectively.
2, register group differences
All the registers of PIC microcontroller, including I/O port, timer and program counter, are in the form of ram, which can be accessed and operated in only one instruction cycle. 5 1 MCU needs two or more cycles to change the contents of the register.
3, pipeline structure differences
5 1 single chip microcomputer adopts single instruction pipeline structure, that is, one instruction is taken and the next instruction is executed; PIC single-chip microcomputer adopts double instruction pipeline structure, when executing one instruction, it is allowed to take down the next instruction at the same time, thus realizing single-cycle instruction.
Second, which is better, pic MCU or 5 1 MCU?
Compared with 5 1 single chip microcomputer, pic single chip microcomputer has its own advantages and disadvantages, which are not necessarily better. Let's compare the advantages and disadvantages of these two single chips:
Advantages and disadvantages of 1 and 5 1 single chip microcomputer
(1) Advantages
The advantage of 5 1 single chip microcomputer is that it has a complete bit-by-bit operating system from internal hardware to software, and the processing object is not words or bytes, but bits, so it can not only handle one bit of some special function registers in the chip, such as sending, setting, clearing and testing. , but also can carry out logical operation on the position, with complete functions and easy use. Although other kinds of single-chip computers also have a bit processing function, they rarely perform bit logic operations. 5 1 MCU has specially opened a dual-function address interval in the on-chip RAM interval, with 16 bytes and unit address of 20H~2FH, which can be used for both byte processing and bit processing (bit processing has 128 bits, and the corresponding bit address is OOH~7FH), and it is extremely flexible to use. This function undoubtedly provides great convenience for users.
Another advantage of 5 1 MCU is the instruction of multiplication and division, which also brings convenience to programming. The division instruction of dividing eight bits by eight bits, the quotient is eight bits, the accuracy is not enough, and it is not used much. However, the product of eight-bit multiplication instruction is sixteen bits, and the accuracy can still meet the requirements, so it is used more. When multiplying, only one instruction is needed. Many eight-bit single-chip computers have no multiplication function, so it is inconvenient to make up a program call when multiplying.
In addition, the I/O pin of 5 1 series is simple to set and use, but it has no output ability at high level, which has advantages and disadvantages. Other series of single chip microcomputer (such as PIC series, AVR series, etc. ) I/O port has been improved and a direction register has been added to determine the input or output, but the use has also become complicated.
(2) Disadvantages
The main disadvantage of 5 1 single chip microcomputer is its slow running speed. When the crystal frequency is 12MHz, the machine cycle reaches 1μs, which obviously cannot meet the needs of modern high-speed operation.
2. Advantages and disadvantages of 2.pic microcontroller.
(1) Advantages
The CPU of PIC single chip microcomputer adopts RISC structure, with 33, 35 and 58 instructions respectively, which is a simplified instruction set, which is much simpler than 5 1 single chip microcomputer (11instructions), so it runs faster. It can make access to program memory and access to data memory be processed in parallel. This instruction pipeline structure completes two parts of work in one cycle, one is to execute the instruction, and the other is to fetch the next instruction from the program memory. It seems that each instruction only needs one cycle (except a few), which is one of the reasons for efficient operation. In addition, it also has the characteristics of low working voltage, low power consumption and strong driving ability.
In addition, the I/O port of PIC series single chip microcomputer is bidirectional, and its output circuit is CMOS complementary push-pull output circuit. The I/O pin adds a direction register to set the input or output state, thus solving the problem that the I/O pin of 5 1 series is both an input and an output when it is at high level. When 1 is set, it is in the input state, and it is in the high impedance state regardless of whether the pin is high or low. When set to 0, it is in the output state. No matter what level of pins, they are in a low resistance state and have considerable driving ability. The low-level sink current can reach 25mA, and the high-level output current can reach 20mA. Compared with 5 1 series, this is a great advantage, it can directly drive the display of digital tube, and the external circuit is simple. Its A/D is 10 bit, which can meet the accuracy requirements.
(2) Disadvantages
In the process of programming, it is inevitable to deal with special registers and repeatedly select the corresponding banks, that is, set or clear the 6th bit (RPl) and 5th bit (RPO) of the status register. This brings some troubles to programming. For pic microcontroller, its bit instruction operation is usually limited to memory bank 0 (00 ~ 7FH). Data transmission and logic operation are basically carried out through the working register W (equivalent to the accumulator A of 5 1 single chip microcomputer), and 5 1 single chip microcomputer can also directly transmit each other through the register, so the bottleneck phenomenon of PIC single chip microcomputer is more serious than that of 5 1 single chip microcomputer, which is very impressive in programming.
On the whole, 5 1 single chip microcomputer has its own advantages compared with pic, and how to choose it mainly depends on the actual use requirements.