Note: This article was previously published by the author on his personal blog, now it is published in the "Jufeng Development" column
Room not Jingyi, "Core Duo" has become synonymous with the computer CPU performance standards, and dual-core from the literal meaning understanding is that there are core two CPU's, originally a computer has only one CPU core to deal with things, if a dual-core CPU, it There are two CPU cores to process things, so the speed and efficiency will be higher.
In the eyes of ordinary people, dual-core computer seems to represent advanced technology and advanced performance. Of course, it also represents advanced price. If you don't believe it, you can review the market price. In the same period, the price of dual-core computer CPU is much higher than that of single-core.
In terms of performance and price, the computer CPU and the single-chip computer are not comparable. If the computer CPU is a big brother, then the single-chip computer is the big boy's horse's horse's horse's horse's horse's horse. Since dual-core computer CPU performance is much stronger than single-core computer, as a single-chip microcomputer that was the same as the computer CPU 800 years ago, if you also use dual-core technology, the performance will probably be improved a lot.
Theoretically speaking, there is no problem in designing a dual-core single-chip microcomputer, but the single-chip microcomputer requires a low price. If a dual-core single-chip microcomputer is designed, assuming that the performance can be doubled, the price will also rise a lot. I am afraid that not many people will be able to use it.
In my subconscious, I have always thought that dual-core single-chip microcomputers are relatively expensive products. There should be no chance to compete with a large number of ordinary single-chip microcomputers with a price less than RMB 1 until the end of last year. The dual-core single-chip microcomputer has completely changed my understanding.
Before introducing this kind of dual-core single-chip microcomputer, let us take a look at some of the single-chip microcomputers currently on the market whose price does not exceed RMB 1 yuan. The specific performance parameters of these single-chip microcomputers are not introduced, and only the rough reference prices are listed here (there may be a slight deviation).
ELAN EM78P153 market reference price 0.7~0.8 yuan
The market reference price of Feiling compatible version 153 is 0.55~0.6 yuan The market reference price of Bojuxing compatible version 153 is 0.45~0.55 yuan The market reference price of models with comparable performance from companies such as McCann and Youhua is 0.6~0.7 yuan
Let us take a look at some of the performance parameters of this microcontroller:
Built-in 2 FPPA processing units
1k Word OTP program memory
64 Bytes RAM data memory, most of the instructions including jump instructions are single-cycle instructions, support bit operations, support hardware delay and wait instructions *Note 1 *Note 2
13 bidirectional IO ports + 1 input port
3-channel 8-bit A/D converter
IO supports VDD/2 voltage to drive LCD
Internal low-speed RC, internal high-speed RC, external oscillator, external RC, external clock optional sleep current working voltage 2.5~5.5V
Working temperature -40~105 degrees Celsius
(*Note 1: The microcontroller supports the delay 100 instruction, which is a delay of waiting for 100+1 cycles)
(*Note 2: The microcontroller supports the wait1 pa.0 instruction, this instruction executes the next instruction when pa.0 is high)
In my personal experience, if you want to find a model that supports any of the functions of PWM, ADC, UART, the price of the single-chip microcomputers on the market is generally more than RMB 1 yuan, and generally only support one of them. Two, unless it is a model whose price reaches 2~3 yuan. And if you choose the single-chip microcomputer with the parameters listed above, your own hardware has directly supported ADC, and you can also implement high-speed PWM and UART functions through software without affecting the main program.
The figure above is a schematic diagram of the internal architecture of the dual-core single-chip microcomputer. It can be seen from the figure that there are two cores inside the single-chip microcomputer, namely FPP0 and FPP1. Each core has its own independent program pointer (PC), stack pointer (SP), and accumulator ( ACC) and status register (CF). The design principle is not complicated. It is to let the two cores share the system clock. The first system clock cycle executes the FPP0 program, and the second system clock cycle executes the FPP1 program, reciprocating in turn, so that the two cores can each run their own program of.
Both cores can access the control RAM and special function registers. Because only one core is working in a system cycle, there will be no situation where two cores write to a RAM or register at the same time. In order to let everyone understand the working mechanism of this dual-core single-chip microcomputer more clearly, I will explain some features in the form of question and answer below.
Sample code:
Address command
0x000 goto main0
0x001 goto main1
...
main0:
...
main1:
...
Answer: After the MCU is powered on, the program pointer of FPP0 points to 0x000 and the program pointer of FPP1 points to 0x001, but the MCU system only starts FPP0, and FPP0 jumps to main0 to start executing the code at that position. FPP1 needs to set the corresponding control register bit in main0 code. start up.
When the system is powered on, only FPP0 is started in order to facilitate the unified initialization of the special function registers. If both FPP0 and FPP1 are initialized separately, it is likely to cause confusion in the system configuration.
2. If I use a jump instruction in main1 to jump to main0, what are the consequences?
goto main0
goto main1
...
main0:
...
main0_loop:
...
goto main0_loop
...
main1:
...
goto main0 //*** Jump here to main0***//
...
Answer: The compiler will report an error, so the consequence is that the code is wrong and cannot be compiled, and the code needs to be deleted.
3. Will it happen that two cores write a RAM variable at the same time and cause write failure?
Answer: Only one core will work in each system clock cycle, so it will not happen that two cores write the same address at the same time.
4. Since FPP1 needs the program of FPP0 to start, will the running speed of FPP0 be doubled when FPP1 is not started?
Answer: Starting FPP1 and not starting FPP1 do not affect the operating speed of FPP0. The speed of FPP0 is always half of the system clock. This is automatically allocated by the system hardware. The effect of not starting FPP1 is that the microcontroller does not have the half of the time that belongs to FPP1. Execute the code.
Lithium Battery Cr17505,3V Lithium Battery,Smoke Detector Batteries,Battery For Smoke Alarm
Jiangmen Hongli Energy Co.ltd , https://www.honglienergy.com