What is the internal structure of single chip microcomputer?
Harper Liu
electronic components and hardware components. sales/regional charity volunteers
#memory #semiconductor #Electronic industry service provider
SCM internal structure analysis
Let's think about a problem, when we write an instruction into the MCU in the programmer, and then take down the MCU, the MCU can execute the instruction, then the instruction must be stored in the MCU somewhere, and this place can keep the instruction will not be lost after the MCU power down, what is this place? This place is the ROM (READ ONLY MEMORY) inside the MCU. Why is it called read-only memory? Didn't we just put two numbers in there? The original ROM in 89C51 is a kind of electric erasable ROM, known as FLASH ROM, just now we are using the programmer, under special conditions by the external device to write the ROM operation, under the normal working conditions of the single chip microcomputer, can only read from that side, can not write the data into, so we still call it ROM.
Two, a few basic concepts
1. The nature and physical phenomena of numbers
We know that computers can perform mathematical operations, which can make us very difficult to understand, the computer, although we do not understand its composition, but it is always just some electronic components, how can mathematical operations? When we do math problems like 37+45, we write 37 on a piece of paper, then write 45 below it, then work on the brain, and finally write the result. The raw materials of the calculation: 37, 45, and the result: 82 are all written on the paper. Where are they placed in the computer? To solve this problem, let us first do an experiment: here is a lamp, we know that the lamp is either on or not on, there are two states, we can use '0' and '1' instead of the two states, the light is' 1 ', the light is' 0 ', the light is' 0 '. Now if I put two lights, how many states do I have? Let's take a look:
Please write down the case of 3 lights. 000 001, 010, 011, 100 101, 110, 111. Let's see, isn't this 000,001,101 the binary number we learned about? Originally, lights on and off is just a physical phenomenon, but when we put them in a certain order better, lights on and off represent numbers. Let's take it a step further. Why is the light on? Look at circuit 1, because the output circuit output high level, to power the lamp. Thus, the light on and off can be replaced by whether the output of the circuit is high or low. In this way, the digit is associated with the high and low level. (Think about it. What other examples have we seen? (Naval) lanterns, flags, telegrams, even red and green lights)
2. The meaning of bits
Through the above experiment, we already know that the level of a light or a wire can represent two states: 0 and 1. In fact, this is a binary BIT, so we call a line a "bit", denoted by a bit.
3. The meaning of bytes
One line can be listed in 0 and 1, two lines can express the four states of 00, 01, 10, 11, that is, can be listed in 0 to 3, and three can express 0 to 7, the computer commonly used 8 lines together, counting at the same time, you can table a total of 256 states from 0 to 255. These eight lines, or eight bits, are called a BYTE.
Source: Anyixi Electronics
How memory works
1. Memory construction
Memory is a place where data is stored. It uses high and low levels to store data, that is, it actually stores high and low levels, rather than the number we are used to think of as 1234, so one of our mysteries is solved, there is nothing mysterious about computers.
As shown on the left of the figure above: A memory is like a small drawer, a small drawer has eight small cells, each cell is used to store the "charge", charge through the wire connected with it to pass in or release, as for the charge in the small cell is stored, we do not have to worry about, you can imagine the wire as a water pipe, the charge in the small cell is like water, it is easy to understand. Each little drawer in the memory is a place to put data, which we call a "unit".
With this structure in place, we can start storing data. To put in a data 12, which is 00001100, we simply fill the second and third cells with charges, while releasing the charges in the other cells (see image on the right). But the problem is, if you look at the picture on the right, a memory has a lot of cells, the lines are parallel, and when you put charges in, you put charges in all of them, and when you release charges, you take charges out of each of them, so that no matter how many cells there are in the memory, you can only put the same number, which of course is not what we want. So, To change the structure a little bit, look at the figure on the right, there's a control line on each cell, which cell I want to put the data into, I give a signal to the control line on that cell, that control line turns the switch on, so the charge can flow freely, and there's no signal on the control line on the other cell, so the switch doesn't turn on, doesn't get affected, and so, As long as the control lines of different cells are controlled, different data can be written to each cell. Similarly, if you want to fetch data from a cell, you only need to turn on the corresponding control switch.
2. Memory decoding
So, how do we control the control lines of each unit? It's not easy. Just direct the control lines of each unit to the outside of the integrated circuit. Things are not so simple, a piece of 27512 memory has 65,536 units, take each wire out, this integrated circuit must have more than 60,000 feet? No, what should we do? Try to reduce the number of lines. We have a way of doing this called decoding, which is very brief: one line can represent two states, two lines can represent four states, three lines can represent several, and how many lines do you need to represent 256 states? 8 kinds, 8 wires, so 65536 states we only need 16 wires to represent.
3. The concept of slice selection and bus of memory
Now that the decoding problem is out of the way, let's focus on another problem. Where do the eight wires that are fed into each unit come from? It is connected from a computer. Normally, these eight wires are connected to other devices besides a memory, as shown in Figure 4. This raises the question: Since these eight wires are not exclusive between the memory and the computer, it is not good if one cell is always connected to these eight wires. For example, the value of this memory cell is 0FFH, and the other memory cell is 00H. Is this line in high level or low level? Should we fight to see who's done it? So we're going to separate them. The method is of course very simple, when the outside line is connected to the pin of the integrated circuit, not directly connected to the units to go, in the middle of a group of switches on the line. Normally we leave the switch on, and if we really want to write data into this memory, or read data out of memory, we just leave the switch on. This set of switches is selected by three leads: read control, write control and slice selector. To write data to the chip, select the chip, then send a write signal, the switch closes, and the incoming data (charge) is written to the chip. If you want to read, select the movie first, then send a read signal, the switch is closed, and the data is sent out. Read and write signals are also connected to another memory at the same time, but because the slice selection end is different, so although there is a read or write signal, but there is no slice selection signal, so the other memory will not "misunderstand" and open the door, resulting in conflict. So what happens if you don't select both chips? Not in a well-designed system, because it's controlled by the computer, not by us, and if it happens that two pieces are selected at the same time, there's a fault in the circuit, and that's not something we're talking about.
As we have seen from the above introduction, the eight wires used to transmit data are not dedicated, but shared by many devices, so we call it the data BUS. The bus is called bus in English, which is the bus lane, and anyone can walk on it. Sixteen address lines are also connected together, called the address bus.