Robot's brain - single chip microcontroller (1)

xiaoxiao2021-03-06  77

Robot's brain - single chip microcontroller (1)

Which microcontroller should automate the calculation, what should it be with the most important part? We calculate a considerable type as a plan for an example. Example: 36 163 × 156-166 ÷ 34. Now you have to make a calculation, you first need a abacus, followed by paper and pen. We record the problem to calculate, and then first calculate 163 × 156, record it with the result of 36, then calculate 166 ÷ 34, then subtract it from the previous result, Get the final result. Now, we use a microcontroller to complete the above process. Original data and intermediate results have to remember various commands prepared by allowing single-chip automatic operations. Such devices are called "memory". In addition, there is a need for a controller that can replace the human role, which can issue a variety of control signals according to the prior given command, so that the entire calculation process can be performed step by step. However, it is not enough to enter these three parts, the original data is input, and the result is output, and it needs to be performed in the order, sometimes it needs to wait. As in the above example, when the number 36 cannot enter the arithmer at the time of the calculation 163 × 156. Therefore, it is necessary to set the "door" of the command to operate on the single-chip command. When the operator needs, the new data is entered. Alternatively, when the operator gets the final result, then the result is output, and the intermediate result cannot be "slip out" microcontroller. This "gate" circuit that performs a certain management of the input and output data is called "port" in the single chip. In the single chip microcomputer, there is basically three types of information in flow, one is data, that is, various raw data (36, 163, etc. in the above example), intermediate results (such as the merchants obtained from 166 ÷ 34, the remaining number 30, etc.), Program (collection of commands), etc. In this way, it is necessary to enter the microcontroller by the external device, and then store it in the memory. During the arithmetic process, the data is calculated from the memory, and the intermediate result of the operation is stored in the memory. Or finally the arithmetic is output by the "entrance". The various commands (programs) that the user wants the single-chip performs (program) is also sent by the memory into the controller in the form of data, and the controller is interpreted (decoded) to various control signals to perform such as addition, minus, multiplication, Except for various commands. Therefore, this type of information is called the control command, that is, the controller is derived by the controller to perform operation and processing step by step, and the read (removed data) of the memory is controlled and written (deposit data). The third type of information is address information, which is to tell the operator and the controller where to take the command to take the data, where to store the result, and use which port input and output information. The memory is divided into read-only memory and read-write memory. The former stores the fixed procedure and constant, the latter stores some data that may change at any time. As the name suggests, once the read-only memory is stored, only the data can only be read, and the ROM, E2PROM, and other ROM can be changed, write data - editor Note). The read and write memory can be stored or read out at any time. In fact, people tend to combine the operator and controllers to be called a central processing unit - CPU. In addition to the operation, the single-chip microcomputer is also completed. So inseparable from counting and timing. Therefore, a timer and a timer counterper counter are provided in the single chip microcomputer, and the basic structure is similar to the example in this contribution (2).

转载请注明原文地址:https://www.9cbs.com/read-108796.html

New Post(0)