Our Latest News

Internal structure analysis of the microcontroller The working principle of memory

More than 10 years ago the first time to buy a 51 microcontroller, color LCD have been quite good, now think about it is still too young. In this article, we look at the internal structure of the microcontroller together.

  A, the internal structure of the microcontroller analysis

Let’s think about a problem, when we write an instruction into the internal microcontroller in the programmer, and then take down the microcontroller, the microcontroller can execute this instruction, then this instruction must be saved in the microcontroller somewhere, and this place in the microcontroller after power down can still keep this instruction will not be lost, what is this place? This place is the internal read-only memory of the microcontroller that is ROM (READ ONLY MEMORY). Why call it read-only memory? Just now we clearly write the two numbers in it? The original ROM in the 89C51 is a kind of electrically erasable ROM, called FLASH ROM, just now we are using the programmer, under special conditions by external devices to write the ROM operation, in the normal working conditions of the microcontroller, can only read from that side, can not write the data in, so we still call it ROM.

This image has an empty alt attribute; its file name is image-137.png

  Second, a few basic concepts

  1, the nature of the number and physical phenomenon

  We know that the computer can do mathematical operations, which makes it very difficult for us to understand, the computer? Although we do not understand its composition, but they are just some electronic components, how can do mathematical operations? We do math problems such as 37 + 45 is done this way, first write 37 on the paper, then write 45 below, and then the brain operations, and finally write the results, the raw materials of the operation: 37, 45 and the results: 82 are written on the paper, and the computer is placed in what place? To solve this problem, let us first do an experiment: here is a lamp, we know that the lamp either light or not, there are two states, we can use ‘0’ and ‘1’ to replace the two states, specify light as ‘1’, not bright for ‘0’. Now put on two lights, how many states are there in total? Let’s look at them in a list.

  Please write on your own 3 lights 000 001 010 011 100 101 110 111 Let’s see, this 000, 001, 101 is not the binary numbers we have learned? Originally, the lights coming on and going off are just a physical phenomenon, but when we put them in a certain order, the lights coming on and going off represent numbers. Let’s abstract a little further, why is the light on? It is because the output circuit outputs a high level and energizes the lamp. Therefore, the lights going on and off can be replaced by whether the output of the circuit is high or low. In this way, the numbers are linked to the high and low levels. (Please think of what other similar examples we have seen. (of the Navy) Light language, flag language, telegrams, and even red and green lights).

2, the meaning of the bit

  Through the above experiment we already know: a light or a line of the level of high and low, can represent two states: 0 and 1. In fact, this is a binary bit, so we will call a line a “bit”, with BIT said.

  3、The meaning of byte

  A line can represent 0 and 1, two lines can express 00, 01, 10, 11 four states, that is, you can express 0 to 3, and three can express 0 ~ 7, computers usually use 8 lines together, while counting, you can express 0-255 a total of 256 states. These 8 lines or 8 bits are called a byte (BYTE).

  The working principle of memory

  1、Memory structure


The memory is where the data is stored. It is the use of the level of high and low to store data, that is, it is actually stored in the level of high, low, rather than what we are accustomed to think of 1234 such numbers, so that we have a mystery solved, the computer is nothing mysterious.

  As shown in the figure above left: a memory is like a small drawer, a small drawer has eight small cells, each small cell is used to store the “charge”, the charge through the wire connected to it to pass in or release, as for the charge in the small cell is how to store, we do not have to worry about it, you can imagine the wire as a water pipe If the charge in the small compartment is like water, then it is well understood. Each small drawer in the memory is a place to put data, we call it a “cell”.

  With such a structure, we can start to store data, want to put in a data 12, that is, 00001100, we just put the second and the third small cell full of charge, and other small cells in the charge to put away on the line (see the above figure right). However, the problem is that there are many cells in a memory, and the lines are connected in parallel, so when we put the charge in, we will put the charge in all the cells, and when we release the charge, we will release the charge in each cell. I want to put data into each unit, I want to put a signal to the unit’s control line, the control line to open the switch, so that the charge can flow freely, while other units on the control line no signal, so the switch does not open, will not be affected, so that, as long as the control line of different units, you can write different data to each unit, the same If you want to take data from a certain unit, you just need to open the corresponding control switch.

  2, memory decoding

  So, how do we control the control line of each unit? This is not simple, the control line of each unit are led to the outside of the integrated circuit is not on the line? Things are not so simple, a 27512 memory has 65536 units, each line is led out, the integrated circuit will have more than 60,000 feet? No, what should we do? We have to think about reducing the number of wires. We have a way to call this decoding, a brief introduction: a line can represent 2 states, 2 lines can represent 4 states, 3 lines can represent several, 256 states and how many lines are needed to represent? 8, 8 lines, so 65536 states we only need 16 lines can represent.

  3, the concept of memory selection and bus

  So far, the problem of decoding is solved, let’s focus on another issue. The eight lines that feed each cell are used from what? It is from the computer, generally, the eight lines in addition to a memory, but also other devices. The problem arises, since the eight lines are not dedicated between the memory and the computer, if a unit is always connected to the eight lines, it is not good, such as the value of this memory unit is 0FFH another memory unit is 00H, then the line is in the high level, or low level? Will it be a fight to see who is experienced? So we have to keep them separated. The solution is of course very simple, when the outside of the line to the integrated circuit pins in, not directly to the units to go, and then add a set of switches in the middle on the line. Usually we let the switch open, if indeed to write data to this memory, or to read data from the memory, and then let the switch on the line. This group of switches is selected by three leads: the read control terminal, the write control terminal and the chip select terminal. To write data to the slice, first select the slice, then send a write signal, the switch closes and writes the data (charge) passed to the slice. To read, first select the slice, then send a read signal, the switch closes, and the data is sent out. Read and write signals are also connected to another memory, but because the chip selection terminal is different, so although there is a read or write signal, but no chip selection signal, so the other memory will not “misunderstand” and open the door, causing conflicts. So will not select two chips at the same time? As long as the system is well-designed will not, because it is controlled by the calculation, not our people control, if there is really the case of two selected chips at the same time, that is the circuit failure, which is not in our discussion.


From the above introduction we have seen that the eight lines used to pass data are not dedicated, but many devices are shared by everyone, so we call it the data bus, the bus is named BUS in English, total that is, the bus lane, who can also go. And the sixteen address lines are also connected together, called the address bus.

    GET A FREE QUOTE

    FPGA IC & FULL BOM LIST

    We'd love to

    hear from you

    Highlight multiple sections with this eye-catching call to action style.

      Contact Us

      Exhibition Bay South Squre, Fuhai Bao’an Shenzhen China

      • Sales@ebics.com
      • +86.755.27389663