中文原文:
单片机介绍
单片机也被称为微控制器(Microcontroller Unit),常用英文字母的缩写MCU表示单片机,它最早是被用在工业控制领域。单片机由芯片内仅有CPU的专用处理器发展而来。最早的设计理念是通过将大量外围设备和CPU集成在一个芯片中,使计算机系统更小,更容易集成进复杂的而对体积要求严格的控制设备当中。INTEL的Z80是最早按照这种思想设计出的处理器,从此以后,单片机和专用处理器的发展便分道扬镳。
早期的单片机都是8位或4位的。其中最成功的是INTEL的8031,因为简单可靠而性能不错获得了很大的好评。此后在8031上发展出了MCS51系列单片机系统。基于这一系统的单片机系统直到现在还在广泛使用。随着工业控制领域要求的提高,开始出现了16位单片机,但因为性价比不理想并未得到很广泛的应用。90年代后随着消费电子产品大发展,单片机技术得到了巨大提高。随着INTEL i960系列特别是后来的ARM系列的广泛应用,32位单片机迅速取代16位单片机的高端地位,并且进入主流市场。而传统的8位单片机的性能也得到了飞速提高,处理能力比起80年代提高了数百倍。目前,高端的32位单片机主频已经超过300MHz,性能直追90年代中期的专用处理器,而普通的型号出厂价格跌落至1美元,最高端[1]的型号也只有10美元。当代单片机系统已经不再只在裸机环境下开发和使用,大量专用的嵌入式操作系统被广泛应用在全系列的单片机上。而在作为掌上电脑和手机核心处理的高端单片机甚至可以直接使用专用的Windows和Linux操作系统。
单片机比专用处理器更适合应用于嵌入式系统,因此它得到了最多的应用。事实上单片机是世界上数量最多的计算机。现代人类生活中所用的几乎每件电子和机械产品中都会集成有单片机。手机、电话、计算器、家用电器、电子玩具、掌上电脑以及鼠标等电脑配件中都配有1-2部单片机。而个人电脑中也会有为数不少的单片机在工作。汽车上一般配备40多部单片机,复杂的工业控制系统上甚至可能有数百台单片机在同时工作!单片机的数量不仅远超过PC机和其他计算的总和,甚至比人类的数量还要多。
单片机又称单片微控制器,它不是完成某一个逻辑功能的芯片,而是把一个计算机系统集成到一个芯片上。相当于一个微型的计算机,和计算机相比,单片机只缺少了I/O设备。概括的讲:一块芯片就成了一台计算机。它的体积小、质量轻、价格便宜、为学习、应用和开发提供了便利条件。同时,学习使用单片机是了解计算机原理与结构的最佳选择。
单片机内部也用和电脑功能类似的模块,比如CPU,内存,并行总线,还有和硬盘作用相同的存储器件,不同的是它的这些部件性能都相对我们的家用电脑弱很多,不过价钱也是低的,一般不超过10元即可......用它来做一些控制电器一类不是很复杂的工作足矣了。我们现在用的全自动滚筒洗衣机、排烟罩、VCD等等的家电里面都可以看到它的身影!......它主要是作为控制部分的核心部件。
它是一种在线式实时控制计算机,在线式就是现场控制,需要的是有较强的抗干扰能力,较低的成本,这也是和离线式计算机的(比如家用PC)的主要区别。
单片机芯片
单片机是靠程序运行的,并且可以修改。通过不同的程序实现不同的功能,尤其是特殊的独特的一些功能,这是别的器件需要费很大力气才能做到的,有些则是花大力气也很难做到的。一个不是很复杂的功能要是用美国50年代开发的74系列,或者60年代的CD4000系列这些纯硬件来搞定的话,电路一定是一块大PCB板!但是如果要是用美国70年代成功投放市场的系列单片机,结果就会有天壤之别!只因为单片机的通过你编写的程序可以实现高智能,高效率,以及高可靠性!
由于单片机对成本是敏感的,所以目前占统治地位的软件还是最低级汇编语言,它是除了二进制机器码以上最低级的语言了,既然这么低级为什么还要用呢?很多高级的语言已经达到了可视化编程的水平为什么不用呢?原因很简单,就是单片机没有家用计算机那样的CPU,也没有像硬盘那样的海量存储设备。一个可视化高级语言编写的小程序里面即使只有一个按钮,也会达到几十K的尺寸!对于家用PC的硬盘来讲没什么,可是对于单片机来讲是不能接受的。 单片机在硬件资源方面的利用率必须很高才行,所以汇编虽然原始却还是在大量使用。一样的道理,如果把巨型计算机上的操作系统和应用软件拿到家用PC上来运行,家用PC的也是承受不了的。
可以说,二十世纪跨越了三个“电”的时代,即电气时代、电子时代和现已进入的电脑时代。不过,这种电脑,通常是指个人计算机,简称PC机。它由主机、键盘、显示器等组成。还有一类计算机,大多数人却不怎么熟悉。这种计算机就是把智能赋予各种机械的单片机(亦称微控制器)。顾名思义,这种计算机的最小系统只用了一片集成电路,即可进行简单运算和控制。因为它体积小,通常都藏在被控机械的“肚子”里。它在整个装置中,起着有如人类头脑的作用,它出了毛病,整个装置就瘫痪了。现在,这种单片机的使用领域已十分广泛,如智能仪表、实时工控、通讯设备、导航系统、家用电器等。各种产品一旦用上了单片机,就能起到使产品升级换代的功效,常在产品名称前冠以形容词——“智能型”,如智能型洗衣机等。现在有些工厂的技术人员或其它业余电子开发者搞出来的某些产品,不是电路太复杂,就是功能太简单且极易被仿制。究其原因,可能就卡在产品未使用单片机或其它可编程逻辑器件上。
单片机历史
单片机诞生于20世纪70年代末,经历了SCM、MCU、SoC三大阶段。
起初模型
1.SCM即单片微型计算机(Single Chip Microcomputer)阶段,主要是寻求最佳的单片形态嵌入式系统的最佳体系结构。“创新模式”获得成功,奠定了SCM与通用计算机完全不同的发展道路。在开创嵌入式系统独立发展道路上,Intel公司功不可没。
2.MCU即微控制器(Micro Controller Unit)阶段,主要的技术发展方向是:不断扩展满足嵌入式应用时,对象系统要求的各种外围电路与接口电路,突显其对象的智能化控制能力。它所涉及的领域都与对象系统相关,因此,发展MCU的重任不可避免地落在电气、电子技术厂家。从这一角度来看,Intel逐渐淡出MCU的发展也有其客观因素。在发展MCU方面,最著名的厂家当数Philips公司。
Philips公司以其在嵌入式应用方面的巨大优势,将MCS-51从单片微型计算机迅速发展到微控制器。因此,当我们回顾嵌入式系统发展道路时,不要忘记Intel和Philips的历史功绩。
嵌入式系统
单片机是嵌入式系统的独立发展之路,向MCU阶段发展的重要因素,就是寻求应用系统在芯片上的最大化解决;因此,专用单片机的发展自然形成了SoC化趋势。随着微电子技术、IC设计、EDA工具的发展,基于SoC的单片机应用系统设计会有较大的发展。因此,对单片机的理解可以从单片微型计算机、单片微控制器延伸到单片应用系统。
单片机的应用领域
目前单片机渗透到我们生活的各个领域,几乎很难找到哪个领域没有单片机的踪迹。导弹的导航装置,飞机上各种仪表的控制,计算机的网络通讯与数据传输,工业自动化过程的实时控制和数据处理,广泛使用的各种智能IC卡,民用豪华轿车的安全保障系统,录像机、摄像机、全自动洗衣机的控制,以及程控玩具、电子宠物等等,这些都离不开单片机。更不用说自动控制领域的机器人、智能仪表、医疗器械了。因此,单片机的学习、开发与应用将造就一批计算机应用与智能化控制的科学家、工程师。
单片机广泛应用于仪器仪表、家用电器、医用设备、航空航天、专用设备的智能化管理及过程控制等领域,大致可分如下几个范畴:
1.在智能仪器仪表上的应用
单片机具有体积小、功耗低、控制功能强、扩展灵活、微型化和使用方便等优点,广泛应用于仪器仪表中,结合不同类型的传感器,可实现诸如电压、功率、频率、湿度、温度、流量、速度、厚度、角度、长度、硬度、元素、压力等物理量的测量。采用单片机控制使得仪器仪表数字化、智能化、微型化,且功能比起采用电子或数字电路更加强大。例如精密的测量设备(功率计,示波器,各种分析仪)。
2.在工业控制中的应用
用单片机可以构成形式多样的控制系统、数据采集系统。例如工厂流水线的智能化管
3.在家用电器中的应用
可以这样说,现在的家用电器基本上都采用了单片机控制,从电饭褒、洗衣机、电冰箱、空调机、彩电、其他音响视频器材、再到电子秤量设备,五花八门,无所不在。
4.在计算机网络和通信领域中的应用
现代的单片机普遍具备通信接口,可以很方便地与计算机进行数据通信,为在计算机网络和通信设备间的应用提供了极好的物质条件,现在的通信设备基本上都实现了单片机智能控制,从手机,电话机、小型程控交换机、楼宇自动通信呼叫系统、列车无线通信、再到日常工作中随处可见的移动电话,集群移动通信,无线电对讲机等。
5.单片机在医用设备领域中的应用
单片机在医用设备中的用途亦相当广泛,例如医用呼吸机,各种分析仪,监护仪,超声诊断设备及病床呼叫系统等等。
6.在各种大型电器中的模块化应用
某些专用单片机设计用于实现特定功能,从而在各种电路中进行模块化应用,而不要求使用人员了解其内部结构。如音乐集成单片机,看似简单的功能,微缩在纯电子芯片中(有别于磁带机的原理),就需要复杂的类似于计算机的原理。如:音乐信号以数字的形式存于存储器中(类似于ROM),由微控制器读出,转化为模拟音乐电信号(类似于声卡)。
在大型电路中,这种模块化应用极大地缩小了体积,简化了电路,降低了损坏、错误率,也方便于更换。
7.单片机在汽车设备领域中的应用
单片机在汽车电子中的应用非常广泛,例如汽车中的发动机控制器,基于CAN总线的汽车发动机智能电子控制器,GPS导航系统,abs防抱死系统,制动系统等等。
此外,单片机在工商,金融,科研、教育,国防航空航天等领域都有着十分广泛的用途。
学习应用六大重要部分
单片机学习应用的六大重要部分
一、总线:
我们知道,一个电路总是由元器件通过电线连接而成的,在模拟电路中,连线并不成为一个问题,因为各器件间一般是串行关系,各器件之间的连线并不很多,但计算机电路却不一样,它是以微处理器为核心,各器件都要与微处理器相连,各器件之间的工作必须相互协调,所以需要的连线就很多了,如果仍如同模拟电路一样,在各微处理器和各器件间单独连线,则线的数量将多得惊人,所以在微处理机中引入了总线的概念,各个器件共同享用连线,所有器件的8根数据线全部接到8根公用的线上,即相当于各个器件并联起来,但仅这样还不行,如果有两个器件同时送出数据,一个为0,一个为1,那么,接收方接收到的究竟是什么呢?这种情况是不允许的,所以要通过控制线进行控制,使器件分时工作,任何时候只能有一个器件发送数据(可以有多个器件同时接收)。器件的数据线也就被称为数据总线,器件所有的控制线被称为控制总线。在单片机内部或者外部存储器及其它器件中有存储单元,这些存储单元要被分配地址,才能使用,分配地址当然也是以电信号的形式给出的,由于存储单元比较多,所以,用于地址分配的线也较多,这些线被称为地址总线。
二、数据、地址、指令:
之所以将这三者放在一起,是因为这三者的本质都是一样的——数字,或者说都是一串‘0’和‘1’组成的序列。换言之,地址、指令也都是数据。指令:由单片机芯片的设计者规定的一种数字,它与我们常用的指令助记符有着严格的一一对应关系,不可以由单片机的开发者更改。地址:是寻找单片机内部、外部的存储单元、输入输出口的依据,内部单元的地址值已由芯片设计者规定好,不可更改,外部的单元可以由单片机开发者自行决定,但有一些地址单元是一定要有的(详见程序的执行过程)。
三、P0口、P2口和P3的第二功能用法:
初学时往往对P0口、P2口和P3口的第二功能用法迷惑不解,认为第二功能和原功能之间要有一个切换的过程,或者说要有一条指令,事实上,各端口的第二功能完全是自动的,不需要用指令来转换。如P3.6、P3.7分别是WR、RD信号,当微片理机外接RAM或有外部I/O口时,它们被用作第二功能,不能作为通用I/O口使用,只要一微处理机一执行到MOVX指令,就会有相应的信号从P3.6或P3.7送出,不需要事先用指令说明。事实上‘不能作为通用I/O口使用’也并不是‘不能’而是(使用者)‘不会’将其作为通用I/O口使用。你完全可以在指令中按排一条SETB P3.7的指令,并且当单片机执行到这条指令时,也会使P3.7变为高电平,但使用者不会这么去做,因为这通常会导致系统的崩溃。
四、程序的执行过程:
单片机在通电复位后8051内的程序计数器(PC)中的值为‘0000’,所以程序总是从‘0000’单元开始执行,也就是说:在系统的ROM中一定要存在‘0000’这个单元,并且在‘0000’单元中存放的一定是一条指令。
五、堆栈:
堆栈是一个区域,是用来存放数据的,这个区域本身没有任何特殊之处,就是内部RAM的一部份,特殊的是它存放和取用数据的方式,即所谓的‘先进后出,后进先出’,并且堆栈有特殊的数据传输指令,即‘PUSH’和‘POP’,有一个特殊的专为其服务的单元,即堆栈指针SP,每当执一次PUSH指令时,SP就(在原来值的基础上)自动加1,每当执行一次POP指令,SP就(在原来值的基础上)自动减1。由于SP中的值可以用指令加以改变,所以只要在程序开始阶段更改了SP的值,就可以把堆栈设置在规定的内存单元中,如在程序开始时,用一条MOV SP,#5FH指令,就时把堆栈设置在从内存单元60H开始的单元中。一般程序的开头总有这么一条设置堆栈指针的指令,因为开机时,SP的初始值为07H,这样就使堆栈从08H单元开始往后,而08H到1FH这个区域正是8031的第二、三、四工作寄存器区,经常要被使用,这会造成数据的混乱。不同作者编写程序时,初始化堆栈指令也不完全相同,这是作者的习惯问题。当设置好堆栈区后,并不意味着该区域成为一种专用内存,它还是可以象普通内存区域一样使用,只是一般情况下编程者不会把它当成普通内存用了。
英文翻译:
MCU Description
SCM is also known as micro-controller (Microcontroller Unit), commonly used letters of the acronym MCU MCU that it was first used in industrial control. Only a single chip by the CPU chip developed from a dedicated processor. The first design is by a large number of peripherals and CPU on a chip in the computer system, smaller, more easily integrated into a complex and demanding on the volume control device which. INTEL's Z80 is the first designed in accordance with this idea processor, then on the development of microcontroller and dedicated processors have parted ways.
Are 8-bit microcontroller early or 4 bits. One of the most successful is the INTEL 8031, for a simple, reliable and good performance was a lot of praise. Then developed in 8031 out of MCS51 MCU Systems. SCM systems based on this system until now is still widely used. With the increased requirements of industrial control field, began a 16-bit microcontroller, because the cost is not satisfactory but have not been very widely used. After 90 years with the great development of consumer electronics, microcontroller technology has been a huge increase. With INTEL i960 series, especially the later series of widely used ARM, 32-bit microcontroller quickly replace high-end 16-bit MCU status and enter the mainstream market. The traditional 8-bit microcontroller performance have been the rapid increase capacity increase compared to 80 the number of times. Currently, high-end 32-bit microcontroller clocked over 300MHz, the performance catching the mid-90's dedicated processor, while the average model prices fall to one U.S. dollars, the most high-end [1] model only 10 dollars. Modern SCM systems are no longer only in the development and use of bare metal environment, a large number of proprietary embedded operating system is widely used in the full range of SCM. The handheld computers and cell phones as the core processing of high-end microcontroller can even use a dedicated Windows and Linux operating systems.
SCM is more suitable than the specific processor used in embedded systems, so it was up to the application. In fact the number of SCM is the world's largest computer. Modern human life used in almost every piece of electronic and mechanical products will be integrated single chip. Phone, telephone, calculator, home appliances, electronic toys, handheld computers and computer accessories such as a mouse with a 1-2 in both the Department of SCM. Personal computer will have a large number of SCM in the work. General car with more than 40 SCM, complex industrial control systems may even have hundreds of SCM in the same time work! SCM is not only far exceeds the number of PC and other computing the sum, or even more than the number of human beings
Single chip, also known as single-chip microcontroller, it is not complete a certain logic chips, but to a computer system integrated into a chip. Equivalent to a micro-computer, and computer than just the lack of a microcontroller I / O devices. General talk: a chip becomes a computer. Its small size, light weight, cheap, for the study, application and development of facilities provided. At the same time, learning to use the MCU is to understand the principle and structure of the computer the best choice.
SCM and the computer functions internally with similar modules, such as CPU, memory, parallel bus, the same effect as well, and hard disk memory devices, and different is its performance of these components were relatively weak many of our home computer, but the price is low , usually not more than 10 yuan you can do with it ...... some control for a class is not very complicated electrical work is enough of. We are using automatic drum washing machine, smoke hood, VCD and so on appliances which could see its shadow! ...... It is primarily as a control section of the core components
It is an online real-time control computer, control-line is that the scene is needed is a stronger anti-jamming ability, low cost, and this is, and off-line computer (such as home PC), the main difference.
Single chip
MCU is through running, and can be modified. Through different procedures to achieve different functions, in particular special unique features, this is another device much effort needs to be done, some great efforts are very difficult to do. A not very complex functions if the 50's with the United States developed 74 series, or the 60's CD4000 series of these pure hardware buttoned, then the circuit must be a large PCB board! But if the United States if the 70's with a series of successful SCM market, the result will be a drastic change! Just because you are prepared by microcomputer programs can achieve high intelligence, high efficiency and high reliability!
As the microcontroller on the cost-sensitive, so now the dominant software or the lowest level assembly language, which is the lowest level in addition to more than binary machine code language, and as so low why is the use? Many high-level language has reached the level of visual programming Why is not it? The reason is simply that there is no home computer as a single chip CPU, not as hard as a mass storage device. A visualization of small high-level language program which even if only one button, will reach tens of K of size! For the home PC's hard drive in terms of nothing, but in terms of the MCU is not acceptable. SCM in the utilization of hardware resources to be very high for the job so although the original is still in the compilation of a lot of use. The same token, if the giant computer operating system and applications run up to get home PC, home PC, also can not afford to.
Can be said that the twentieth century across the three "power" era, that is, the age of electricity, the electronic age and has entered into the computer age. However, this computer, usually refers to the personal computer, referred to as PC. It consists of the host, keyboard, monitor and other components. Another type of computer, most people do not know how. This computer is to give all kinds of intelligent machines single chip (also known as micro-controller). As the name suggests, this computer system took only a minimal integrated circuit, can be a simple operation and control. Because it is small, usually hidden in the charged mechanical "stomach" in. It is in the device, like the human brain plays a role, it goes wrong, the whole plant was paralyzed. Now, this microcontroller has a very broad field of use, such as smart meters, real-time industrial control, communications equipment, navigation systems, and household appliances. Once all kinds of products were using SCM, can serve to upgrade the effectiveness of products, often in the product name preceded by the adjective - "intelligent," such as intelligent washing machines. Now some technical personnel of factories or other amateur electronics developers to engage in out of certain products, not the circuit is too complicated, that function is too simple and can easily be copied. The reason may be stuck in the product did not use a microcontroller or other programmable logic device.
SCM history
SCM was born in the late 20th century, 70, experienced SCM, MCU, SoC three stages.
First model
1.SCM the single chip microcomputer (Single Chip Microcomputer) stage, mainly seeking the best of the best single form of embedded systems architecture. "Innovation model" success, laying the SCM and general computer completely different path of development. In the open road of independent development of embedded systems, Intel Corporation contributed.
2.MCU the micro-controller (Micro Controller Unit) stage, the main direction of technology development: expanding to meet the embedded applications, the target system requirements for the various peripheral circuits and interface circuits, highlight the object of intelligent control. It involves the areas associated with the object system, therefore, the development of MCU's responsibility inevitably falls on electrical, electronics manufacturers. From this point of view, Intel faded MCU development has its objective factors. In the development of MCU, the most famous manufacturers as the number of Philips Corporation.
Philips company in embedded applications, its great advantage, the MCS-51 single-chip micro-computer from the rapid development of the micro-controller. Therefore, when we look back at the path of development of embedded systems, do not forget Intel and Philips in History.
Embedded Systems
Embedded system microcontroller is an independent development path, the MCU important factor in the development stage, is seeking applications to maximize the solution on the chip; Therefore, the development of dedicated single chip SoC trend of the natural form. As the microelectronics, IC design, EDA tools development, application system based on MCU SoC design have greater development. Therefore, the understanding of the microcontroller chip microcomputer can be, extended to the single-chip micro-controller applications.
MCU applications
SCM now permeate all areas of our lives, which is almost difficult to find traces of the field without SCM. Missile navigation equipment, aircraft, all types of instrument control, computer network communications and data transmission, industrial automation, real-time process control and data processing, extensive use of various smart IC card, civilian luxury car security system, video recorder, camera, fully automatic washing machine control, and program-controlled toys, electronic pet, etc., which are inseparable from the microcontroller. Not to mention the area of robot control, intelligent instruments, medical equipment was. Therefore, the MCU learning, development and application of the large number of computer applications and intelligent control of the scientists, engineers.
SCM is widely used in instruments and meters, household appliances, medical equipment, aerospace, specialized equipment, intelligent management and process control fields, roughly divided into the following several areas:
1. In the application of Intelligent Instruments
SCM has a small size, low power consumption, controlling function, expansion flexibility, the advantages of miniaturization and ease of use, widely used instrument, combining different types of sensors can be realized Zhuru voltage, power, frequency, humidity, temperature, flow, speed, thickness, angle, length, hardness, elemental, physical pressure measurement. SCM makes use of digital instruments, intelligence, miniaturization, and functionality than electronic or digital circuits more powerful. Such as precision measuring equipment (power meter, oscilloscope, various analytical instrument).
2. In the industrial control application
With the MCU can constitute a variety of control systems, data acquisition system. Such as factory assembly line of intelligent control
3. In Household Appliances
Can be said that the appliances are basically using SCM, praise from the electric rice, washing machines, refrigerators, air conditioners, color TV, and other audio video equipment, to the electronic weighing equipment, varied, and omnipresent.
4. In the field of computer networks and communications applications
MCU general with modern communication interface, can be easy with the computer data communication, networking and communications in computer applications between devices had excellent material conditions, are basically all communication equipment to achieve a controlled by MCU from mobile phone, telephone, mini-program-controlled switchboards, building automated communications call system, train radio communication, to the daily work can be seen everywhere in the mobile phones, trunked mobile radio, walkie-talkies, etc..
5. Microcomputer in the field of medical device applications
SCM in the use of medical devices is also quite extensive, such as medical respirator, the various analyzers, monitors, ultrasound diagnostic equipment and hospital beds, etc. call system.
6. In a variety of major appliances in the modular applications
Designed to achieve some special single specific function to be modular in a variety of circuit applications, without requiring the use of personnel to understand its internal structure. If music integrated single chip, seemingly simple function, miniature electronic chip in the net (the principle is different from the tape machine), you need a computer similar to the principle of the complex. Such as: music signal to digital form stored in memory (like ROM), read by the microcontroller, analog music into electrical signals (similar to the sound card).
In large circuits, modular applications that greatly reduce the volume, simplifies the circuit and reduce the damage, error rate, but also easy to replace.
7. Microcontroller in the application field of automotive equipment
SCM in automotive electronics is widely used, such as a vehicle engine controller, CAN bus-based Intelligent Electronic Control Engine, GPS navigation system, abs anti-lock braking system, brake system, etc..
In addition, the MCU in business, finance, research, education, national defense, aerospace and other fields has a very wide range of applications.
Application of six important part of learning
MCU learning an important part of the six applications
1, Bus:
We know that a circuit is always made by the devices connected by wires, in analog circuits, the connection does not become a problem because the device is a serial relationship between the general, the device is not much connection between the , but the computer is not the same circuit, it is a microprocessor core, the device must be connected with the microprocessor, the device must be coordination between, so they need to connect on a lot, as if still analog circuit like the microprocessor and devices in the connection between the individual, the number of lines will be a little more surprising, therefore the introduction of the microprocessor bus 概念 Zhong Each device Gongtong access connections, all devices 8 Shuju line all received eight public online, that is the equivalent of all devices together in parallel, but only this does not work, if there are two devices send data at the same time, a 0, a 1, then, whether the receiver received what is it? This situation is not allowed, so to be controlled by controlling the line, time-sharing the device to work at any time only one device to send data (which can have multiple devices to receive both). Device's data connection is known as the data bus, the device is called line of control all the control bus. Internal or external memory in the microcontroller and other devices have memory cells, the memory cell to be assigned addresses, you can use, distribution, of course, to address given in the form of electrical signals, and as more memory cells, so, for the address allocation The line is also more of these lines is called the address bus.
Second, data, address, command:
The reason why these three together because of the nature of these three are the same - the number, or are a string of '0 'and '1' form the sequence. In other words, addresses, instructions are also data. Instruction: from single chip designer provides a number of commonly used instructions with mnemonic we have a strict correspondence between the developer can not be changed by the MCU. Address: the search for MCU internal, external storage units, input and output port based on the address of the internal unit value provided by the chip designer is good, can not be changed, the external unit can be single chip developers to decide, but there are a number of address units is a must (see procedures for the implementation of the process).
Third, P0 port, P2 and P3 of the second function I use:
Beginners often on the P0 port, P2 and P3 port I use the second function puzzled that the second function and have a switch between the original function of the process, or have a directive, in fact, the port The second feature is automatic, do not need instructions to convert. Such as P3.6, P3.7 respectively WR, RD signal, when the microchip processing machines external RAM or external I / O port, they are used as a second function, not as a general-purpose I / O port used, so long as a A microprocessor implementation of the MOVX instruction, there will be a corresponding signal sent from the P3.6 or P3.7, no prior use of commands. In fact 'not as a general-purpose I / O port use' is also not a 'no' but (user) 'not' as a general-purpose I / O port to use. You can arrange the order of a SETB P3.7's instructions, and when the MCU execution to the instruction, the also make P3.7 into a high, but users will not do so because this is usually will cause the system to collapse.
Fourth, the program's implementation:
Reduction in power after the 8051 microcontroller within the program counter (PC) in the value of 0000 ', the process is always from the 0000' units started, that is: the system must exist in ROM 0000 'this unit , and in 0000 'unit must be stored in a single instruction.
5, the stack:
Stack is a region, is used to store data, there is no special about the region itself is a part of internal RAM, special access to its data storage and the way that the so-called 'advanced post out backward first out ', and the stack has a special data transmission instructions that' PUSH 'and' POP ', has a special expertise in its services unit, that is, the stack pointer SP, whenever a PUSH instruction execution, SP on (in the Based on the original value) automatically add 1, whenever the implementation of a POP instruction, SP will (on the basis of the original value) automatically by 1. As the SP values can be changed with the instructions, so long as the beginning of the process to change the value of the SP, you can set the stack memory unit required, such as the program begins, with an MOV SP, # 5FH instructions When set on the stack starting from the memory unit 60H unit. There is always the beginning of the general procedure with such a directive to set the stack pointer, because boot, SP initial value of 07H, 08H This unit from the beginning to stack next, and 08H to 1FH 8031 is the second in the region, three or four working register area, often used, this will lead to confusion of data. Different authors when writing programs, initialize the stack is not exactly the same directive, which is the author's habit. When set up the stack zone, does not mean that the region become a special memory, it can still use the same memory region as normal, but generally the programmer does not regard it as an ordinary memory used.