In actual use, in order to locate the data in the ROM during operation, each 8-bit memory cell has a fixed "address", usually expressed in 16-digit numbers: for example, for a so-called 4K ROM, the address is from 0000H. To 0FFFH, (that is, from 0000, 0001...4095), from which address the microcontroller is running, the data is completely determined by the program itself, and we do not want to intervene. Remember to power on the microcontroller, it goes through a short reset process, immediately to the lowest address of the ROM 0000H, placed here is often a "jump" instruction, it jumps from one step to another address: program The real starting address, such as the 0080H of the 51 machine. Is there only instructions in the ROM that can't be ordered? The ROM is the program memory, in addition to the instructions, it also includes some fixed data necessary to run the program. If we want to output 00H to FFH (255) on a certain port of the microcontroller, the value of the sine half-wave change, 10,000 times per second, then if it is hard to calculate it according to the formula, for it, it is not relieved, but we can Store the pre-calculated values ​​in the ROM and take them out at the time.
When it comes to data memory, it is actually a piece of memory that can access data at any time, that is, a memory that can be read (taken) or written (stored), referred to as RAM. The RAM used in the current MCU belongs to static RAM or SRAM. It is different from the memory stick used in the computer. As long as you write the data to the SRAM, as long as it is powered off or not cleared, the data is always stored there. The computer is using dynamic RAM, and it is necessary to constantly add refresh pulses to it. In order to save the data. Because the amount of information processed by the microcontroller is much smaller than that of the computer, it also has less RAM: from no, with 128, 256, ... 1K, 2K to 4K, much less than the ROM. Because in fact, RAM is only temporarily stored as data, unless the image processing needs to store a large amount of data, generally for the implementation of simpler tasks, there are so many SCMs, if it is not enough, you can only take additional SRAM. 6116, 6264, etc. to expand. In order to access the 8-bit binary number of the RAM unit, of course, the same address as the ROM is used to indicate its specific location. If a single-chip microcomputer has 1K (1024) RAM, its address is also from 0000 to 1024, or 16 The number of 0000H to 03FFH is visible and the address of the ROM is the same, will not be confused? No, because the read ROM is performed by the program pointer of the microcontroller or the branch instruction or the table lookup instruction, and these instructions will not enter the RAM area. The read/write RAM is another data transfer instruction and will not enter the ROM area. This is also different from the computer. The latter program and data are in the memory stick, and the address is different. Foresee the consequences. This memory structure of a single chip microcomputer is also called a Harvard structure.
In this article, the RAM, which is used in the MCU, is mainly used to store temporary data, such as temperature measurement with a single-chip microcomputer, measuring once per second, showing the average value of 1 minute (updated once every minute); we pass first Sensor, amplifier circuit, A/D conversion, convert the temperature analog quantity into a proportional binary number, then store the digital quantity into the RAM of the microcontroller sequentially through the input port once every second, and then perform two on them. The calculation of the two summation and reaveraging (off-topic: it is more troublesome to perform the "division" operation on the single-chip microcomputer. The exception is that dividing by 2, 4, 8... is very simple. Using the "right shift" command 1, 2, 3 times Yes) The last value is displayed, then the 60 memory cells are all written to 0 to clear the old data, and the next time it is cycled like this. In addition, there are a number of registers in the MCU, but the number is small but the effect is very large. In addition to the temporary data, it can also be exchanged, processed, transferred, etc., and the current status of the MCU is recorded at any time. The input and output ports are also used as special functions. The existence of registers, the specifics are different, it is not easy to talk about it, it depends on the books.
Features
â—† Small Compact Size,Global safety approvals
â—† Long life & high reliability.
â—† Wide Range of wires Terminals.
â—†Variety of actuator and terminals
â—†Customized Designs
â—†Widely used in household appliances, electric force, telecommunications, machine tool, vessel, textile, printing, Mining machine, Mustic Instrument, etc.
Miniature Micro Switch,Ultra Miniature Micro Switch,Micro Miniature Slide Switch,Miniature Snap Action Switch
Ningbo Jialin Electronics Co.,Ltd , https://www.donghai-switch.com