基于單片機的教室照明智能控制器設計含5張CAD圖
基于單片機的教室照明智能控制器設計含5張CAD圖,基于,單片機,教室,照明,智能,控制器,設計,cad
外文翻譯中英文對照外文原文
Structure and function of the MCS-51 series
Structure and function of the MCS-51 series one-chip computer MCS-51 is a name of a piece of one-chip computer series which Intel Company produces. This company introduced 8 top-grade one-chip computers of MCS-51 series in 1980 after introducing 8 one-chip computers of MCS-48 series in 1976. It belong to a lot of kinds this line of one-chip computer the chips have,such as 8051, 8031, 8751, 80C51BH, 80C31BH,etc., their basic composition, basic performance and instruction system are all the same. 8051 daily representatives- 51 serial one-chip computers .
An one-chip computer system is made up of several following parts: (1) One microprocessor of 8 (CPU). (2) At slice data memory RAM (128B/256B),it use not depositting not can reading /data that write, such as result not middle of operation, final result and data wanted to show, etc. (3) Procedure memory ROM/EPROM (4KB/8KB ), is used to preserve the procedure , some initial data and form in slice. But does not take ROM/EPROM within some one-chip computers, such as 8031 , 8032, 80C ,etc.. (4) Four 8 run side by side I/O interface P0 four P3, each mouth can use as introduction , may use as exporting too. (5) Two timer / counter, each timer / counter may set up and count in the way, used to count to the external incident, can set up into a timing way too, and can according to count or result of timing realize the control of the computer. (6) Five cut off cutting off the control system of the source . (7) One all duplexing serial I/O mouth of UART (universal asynchronous receiver/transmitter (UART) ), is it realize one-chip computer or one-chip computer and serial communication of computer to use for. (8) Stretch oscillator and clock produce circuit, quartz crystal finely tune electric capacity need outer. Allow oscillation frequency as 12 megahertas now at most. Every the above-mentioned part was joined through the inside data bus .Among them, CPU is a core of the one-chip computer, it is the control of the computer and command centre, made up of such parts as arithmetic unit and controller , etc.. The arithmetic unit can carry on 8 persons of arithmetic operation and unit ALU of logic operation while including one, the 1 storing device temporarilies of 8, storing device 2 temporarily, 8's accumulation device ACC, register B and procedure state register PSW, etc. Person who accumulate ACC count by 2 input ends entered of checking etc. temporarily as one operation often, come from person who store 1 operation is it is it make operation to go on to count temporarily , operation result and loopback ACC with another one. In addition, ACC is often regarded as the transfer station of data transmission on 8051 inside . The same as general microprocessor, it is the busiest register. Help remembering that agreeing with A expresses in the order. The controller includes the procedure counter , the order is depositted, the order decipher, the oscillator and timing circuit, etc. The procedure counter is made up of counter of 8 for two, amounts to 16. It is a byte address counter of the procedure in fact, the content is the next IA that will carried out in PC. The content which changes it can change the direction that the procedure carries out . Shake the circuit in 8051 one-chip computers, only need outer quartz crystal and frequency to finely tune the electric capacity, its frequency range is its 12MHZ of 1.2MHZ. This pulse signal, as 8051 basic beats of working, namely the minimum unit of time. 8051 is the same as other computers, the work in harmony under the control of the basic beat, just like an orchestra according to the beat play that is commanded.
There are ROM (procedure memory , can only read ) and RAM in 8051 slices (data memory, can is it can write ) two to read, they have each independent memory address space, dispose way to be the same with general memory of computer. Procedure 8051 memory and 8751 slice procedure memory capacity 4KB, address begin from 0000H, used for preserving the procedure and form constant. Data 8051- 8751 8031 of memory data memory 128B, address false 00FH, use for middle result to deposit operation, the data are stored temporarily and the data are buffered etc.. In RAM of this 128B, there is unit of 32 byteses that can be appointed as the job register, this and general microprocessor is different, 8051 slice RAM and job register rank one formation the same to arrange the location. It is not very the same that the memory of MCS-51 series one-chip computer and general computer disposes the way in addition. General computer for first address space, ROM and RAM can arrange in different space within the range of this address at will, namely the addresses of ROM and RAM, with distributing different address space in a formation. While visiting the memory, corresponding and only an address Memory unit, can ROM, it can be RAM too, and by visiting the order similarly. This kind of memory structure is called the structure of Princeton. 8051 memories are divided into procedure memory space and data memory space on the physics structure, there are four memory spaces in all: The procedure stores in one and data memory space outside data memory and one in procedure memory space and one outside one, the structure forms of this kind of procedure device and data memory separated form data memory, called Harvard structure. But use the angle from users, 8051 memory address space is divided into three kinds: (1) In the slice, arrange blocks of FFFFH , 0000H of location , in unison outside the slice (use 16 addresses). (2) The data memory address space outside one of 64KB, the address is arranged from 0000H 64KB FFFFH (with 16 addresses ) too to the location. (3) Data memory address space of 256B (use 8 addresses). Three above-mentioned memory space addresses overlap, for distinguishing and designing the order symbol of different data transmission in the instruction system of 8051: CPU visit slice, ROM order spend MOVC , visit block RAM order uses MOVX outside the slice, RAM order uses MOV to visit in slice.
8051 one-chip computer have four 8 walk abreast I/O port, call P0, P1, P2 and P3. Each port is 8 accurate two-way mouths, accounts for 32 pins altogether. Every one I/O line can be used as introduction and exported independently. Each port includes a latch (namely special function register ), one exports the driver and a introduction buffer . Make data can latch when outputting, data can buffer when making introduction , but four function of passway these self-same. Expand among the system of memory outside having slice, four port these may serve as accurate two-way mouth of I/O in common use. Expand among the system of memory outside having slice, P2 mouth see high 8 address off; P0 mouth is a two-way bus, send the introduction of 8 low addresses and data / export in timesharing
Output grade , P3 of mouth , P1 of P1 , connect with inside have load resistance of drawing , every one of they can drive 4 Model LS TTL load to output. As while inputting the mouth, any TTL or NMOS circuit can drive P1 of 8051 one-chip computers as P3 mouth in a normal way . Because draw resistance on output grade of them have, can open a way collector too or drain-source resistance is it urge to open a way, do not need to have the resistance of drawing outerly . Mouths are all accurate two-way mouths too. When the conduct is input, must write the corresponding port latch with 1 first . As to 80C51 one-chip computer, port can only offer milliampere of output electric currents, is it output mouth go when urging one ordinary basing of transistor to regard as, should contact a resistance among the port and transistor base , in order to the electricity while restraining the high level from exporting P1~P3 Being restored to the throne is the operation of initializing of an one-chip computer. Its main function is to turn PC into 0000H initially , make the one-chip computer begin to hold the conduct procedure from unit 0000H. Except that the ones that enter the system are initialized normally,as because procedure operate it make mistakes or operate there aren't mistake, in order to extricate oneself from a predicament , need to be pressed and restored to the throne the key restarting too. It is an input end which is restored to the throne the signal in 8051 China RST pin. Restore to the throne signal high level effective , should sustain 24 shake cycle (namely 2 machine cycles ) the above its effective times. If 6 of frequency of utilization brilliant to shake, restore to the throne signal duration should exceed 4 delicate to finish restoring to the throne and operating. Produce the logic picture of circuit which is restored to the throne the signal:
Restore to the throne the circuit and include two parts outside in the chip entirely. Outside that circuit produce to restore to the throne signal (RST ) hand over to Schmitt's trigger, restore to the throne circuit sample to output , Schmitt of trigger constantly in each S5P2 , machine of cycle in having one more , then just got and restored to the throne and operated the necessary signal insidly. Restore to the throne resistance of circuit generally, electric capacity parameter suitable for 6 brilliant to shake, can is it restore to the throne signal high level duration greater than 2 machine cycles to guarantee. Being restored to the throne in the circuit is simple, its function is very important. Pieces of one-chip computer system could normal running,should first check it can restore to the throne not succeeding. Checking and can pop one's head and monitor the pin with the oscillograph tentatively, push and is restored to the throne the key, the wave form that observes and has enough range is exported (instantaneous), can also through is it restore to the throne circuit group holding value carry on the experiment to change.
At present,MCU to infiltrate 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,all kinds of alarm systems,and computer networks constitute a secondary control system.
(3) In the Appliance of Household appliances
It 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
MCU 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.
中文翻譯
51 系列單片機的功能和結構
一個單片機的系統(tǒng)是由以下幾部分組成:(1)一個 8 位CPU 微處理器。(2)靜態(tài)隨機存取存儲器,能夠儲存程序運行過程中產(chǎn)生的數(shù)據(jù)。(3)程序存儲器 ROM / EPRO中(4KB/8KB),用來保存程序和一些初始數(shù)據(jù)。但是在一些單片機中不使用 ROM / EPROM 中,如 8031,8032,80c 系列等。(4)4 個 8 排的 I / O 并行接口P0 ~P3,每個口可以用作輸入,也可以用作輸出。(5)2 個定時器/計數(shù)器,每個定時器/計數(shù)器可設置計數(shù)用來計數(shù)外部事件,可以設置成常用的定時方式,并可以根據(jù)計算或結果控制單片機的運行。(6)五個中斷源控制系統(tǒng)。(7)1 個雙向串行 I / O 口的 UART(通用異步接收器/發(fā)送器UART),用于實現(xiàn)單片機的串行通信。(8)振蕩器和時鐘產(chǎn)生電路,需要外部電源的石英晶體微調(diào)電路,允許接在 12v 的振蕩頻率上。上述部分通過內(nèi)部數(shù)據(jù)總線連接。其中,CPU 是單片機的核心,它是單片機的控制和指揮中心,ALU 算數(shù)邏輯運算單元可進行算術運算和邏輯運算,由 1 個 8 暫時存儲器,和 2 個 8 位的累加器組成。Acc 累加器是 ALU 運算結果的存放單元,一般數(shù)據(jù)通過它來傳送。此外,Acc 往往被視為對 8051 內(nèi)的數(shù)據(jù)傳輸中轉站。和通常的微處理器一樣,它是最繁忙的寄存器。有記憶功能并執(zhí)行命令。該控制器包括程序計數(shù)器,可讀寫的存儲器,振蕩器和定時電路等。該程序計數(shù)器是有兩對 8 或 16 位計數(shù)器,它是一個字節(jié)地址計數(shù)器, 在個人電腦運行程序時,執(zhí)行下一個單元的內(nèi)容,程序執(zhí)行時可以改變它的內(nèi)容從而改變運行的結果。在 8051 芯片震蕩電路中,需要外接石英晶體和微調(diào)電容,其頻率范圍為 1.2MHz—12MHz。該脈沖信號,即為 8051 的工作周期,是最小的時間單位。8051 和其他單片機一樣,都有相同的控制和功能,就像樂隊也有打擊樂器一樣。
在 8051 中有 ROM(程序存儲器,只能讀取),和 RAM(數(shù)據(jù)存儲器,可以讀和寫),他們有各自獨立的內(nèi)存地址空間,也有相同的處理方式。8051 和 8751 的程序存儲器的存儲容量為 4KB,地址從 0000H 開始,在使用過程中其中的數(shù)據(jù)不變。8051、8751、8031 數(shù)據(jù)存儲器的內(nèi)存為 128B, 默認地址是 00FH,用于保存中間數(shù)據(jù)和緩存。在這 128B 的內(nèi)存中,有 32 byteses,被稱作工作寄存器,和常用的微處理器不同的是,8051 的 RAM 是按功能來劃分模塊的。MCS - 51 系列單片機和一般電腦的處理方式不同。一般電腦會自動分配地址空間,ROM 和 RAM 的計算機可以安排在不同的空間內(nèi),地址范圍會根據(jù)ROM 和RAM 的位置分配不同地址空間。在訪問的內(nèi)存,不管是ROM 和RAM,只有一個地址對應一個內(nèi)存單元,都要按這個順序訪問。這種內(nèi)存結構是所謂的普林斯頓結構。 8051 的存儲器按物理結構劃分可分為程序存儲器空間和數(shù)據(jù)存儲空間,共有四個內(nèi)存空間, 按結構位置的不同分為內(nèi)部程序存儲空間、外部程序存儲空間、內(nèi)部數(shù)據(jù)存儲空間和外部數(shù)據(jù)存儲空間。但從用戶的使用角度看,8051 存儲器地址空間被分成三類:(1)片內(nèi),安排 FFFFH 的塊,片外的(使用 16 個地址)串口 0000H 地址。(2)外部數(shù)據(jù)存儲器地址空間為 64KB,地址是從 0000H 到 FFFFH(含 16 個地址)的位置排列也。(3)256B 的數(shù)據(jù)存儲器(使用 8 個地址)的地址空間。上述三個重疊的內(nèi)存空間地址,用 8051 指令系統(tǒng)的傳輸不同的數(shù)據(jù)和使用的功能區(qū)分。CPU 的訪問內(nèi)存時,訪問 ROM 使用 MOVC 語句,訪問 RAM 塊順序使用片外操作的MOVX 語句,訪問內(nèi)存片段使用 MOV 語句。
8051 單片機有 4 個 8 位并行的 I / O 端口,分別為P0,P1,P2 和P3。每個端口是 8 位精確的雙向口,共占了 32 針。每一個 I / O 線可作為獨立的入口和出口。每個端口包括一個鎖存器(即特殊功能寄存器),一個出口驅動器和引進緩沖器。使數(shù)據(jù)能夠鎖存輸出,數(shù)據(jù)可以及時緩沖,其余四個具有相同的功能。接外部存儲擴大它們的內(nèi)存時,這四個口就可作為雙向口常用的 I / O 口,這是,P2 口看到高 8 位地址,P0 口是一個公共兩用口,傳送輸出低 8 的地址和數(shù)據(jù)。
P3 口的輸出級別小于P1,可以在里面繪制負載電阻,每一個都能驅動 4 個 LS 型TTL 負載輸出。作為輸入口時,所有 TTL 或 NMOS 電路都可以驅動一個正常的方式 8051 - P3 口作為單片機的 P1口??梢岳酶淖冸娮璧妮敵龃笮?,直接地充當震蕩開路,不需要添加外部電阻。其中每個口都是標準的雙向口。當在當做輸入口時,必須把相應的端口置 1 來鎖閉輸出。比如 8051 單片機,所有端口提供的輸出電流只能幾毫安,用作輸出口時接一個普通的晶體管,要穩(wěn)定使用,還要接一定電阻。其主要功能是把初始地址設為 0000H,使單片機從 0000H 的地址開始運行程序。除了正常進入系統(tǒng)的初始化,由于操作失誤或操作過程錯誤,也要能夠解決錯誤,重新運行。在 8051 中 RST 引腳是一個輸入復位鍵,復位鍵高電平信號有效,要保證 24 倍以上的時鐘周期(即 2 個機器周期)。如果收到高頻的 6v 輸入信號,單片機就會復位。
初始化時,需要兩部分外部電路。外部電路采用施密特觸發(fā)方式觸發(fā)了復位鍵(RST),形成了復位信號輸出電路,并把信號傳送到每個引腳,按順序到了復位引腳,就會迅速響應信號指令。復位功能的可靠性,適合 6v 電壓的電容震蕩電路,復位信號的周期可以大于兩個機器周期。雖然復位電路的結構很簡單,但它的功能是非常重要的。一個單片機系統(tǒng)能否正常運行,應先檢查它有沒有正確的復位電路。檢查和檢測其發(fā)出信號,用示波器顯示時,結合復位電路很重要,觀察波形時, 輸出口(瞬時)的波動范圍是很大的,也可以通過復位電路對實驗進行有必要的改變。
目前單片機滲透到我們生活的各個領域,幾乎很難找到哪個領域沒有單片機的蹤跡。導彈的導航裝置,飛機上各種儀表的控制,計算機的網(wǎng)絡通訊與數(shù)據(jù)傳輸,工業(yè)自動化過程的實時控制和數(shù)據(jù)處理,廣泛使用的各種智能 IC 卡,民用豪華轎車的安全保障系統(tǒng),錄像機、攝像機、全自動洗衣機的控制,以及程控玩具、電子寵物等等,這些都離不開單片機。更不用說自動控制領域的機器人、智能儀表、醫(yī)療器械了。因此,單片機的學習、開發(fā)與應用將造就一批計算機應用與智能化控制的科學家、工程師。
單片機廣泛應用于儀器儀表、家用電器、醫(yī)用設備、航空航天、專用設備的智能化管理及過程控制等領域,大致可分如下幾個范疇:
(1) 在智能儀器儀表上的應用
單片機具有體積小、功耗低、控制功能強、擴展靈活、微型化和使用方便等優(yōu)點,廣泛應用于儀器儀表中,結合不同類型的傳感器,可實現(xiàn)諸如電壓、功率、頻率、濕度、溫度、流量、速度、厚度、角度、長度、硬度、元素、壓力等物理量的測量。采用單片機控制使得儀器儀表數(shù)字化、智能化、微型化,且功能比起采用電子或數(shù)字電路更加強大。例如精密的測量設備(功率計,示波器, 各種分析儀)。
(2) 在工業(yè)控制中的應用
用單片機可以構成形式多樣的控制系統(tǒng)、數(shù)據(jù)采集系統(tǒng)。例如工廠流水線的智能化管、電梯智能化控制、各種報警系統(tǒng),與計算機聯(lián)網(wǎng)構成二級控制系統(tǒng)等。
(3) 在家用電器中的應用
可以這樣說,現(xiàn)在的家用電器基本上都采用了單片機控制,從電飯煲、洗衣機、電冰箱、空調(diào)機、彩電、其他音響視頻器材、再到電子秤量設備,五花八門,無所不在。
(4) 在計算機網(wǎng)絡和通信領域中的應用
現(xiàn)代的單片機普遍具備通信接口,可以很方便地與計算機進行數(shù)據(jù)通信,為在計算機網(wǎng)絡和通信設備間的應用提供了極好的物質(zhì)條件,現(xiàn)在的通信設備基本上都實現(xiàn)了單片機智能控制,從手機, 電話機、小型程控交換機、樓宇自動通信呼叫系統(tǒng)、列車無線通信、再到日常工作中隨處可見的移動電話,集群移動通信,無線電對講機等。
(5) 單片機在醫(yī)用設備領域中的應用
單片機在醫(yī)用設備中的用途也相當廣泛,例如醫(yī)用呼吸機,各種分析儀,監(jiān)護儀,超聲診斷設備及病床呼叫系統(tǒng)等等。
(6) 在各種大型電器中的模塊化應用
某些專用單片機設計用于實現(xiàn)特定功能,從而在各種電路中進行模塊化應用,而不要求使用人員了解其內(nèi)部結構。如音樂集成單片機,看似簡單的功能,微縮在純電子芯片中(有別于磁帶機的原理),就需要復雜的類似于計算機的原理。如:音樂信號以數(shù)字的形式存于存儲器中(類似于 ROM),由微控制器讀出,轉化為模擬音樂電信號(類似于聲卡)。 在大型電路中,這種模塊化應用極大地縮小了體積,簡化了電路,降低了損壞、錯誤率,也方便于更換。
(7) 單片機在汽車設備領域中的應用
單片機在汽車電子中的應用非常廣泛,例如汽車中的發(fā)動機控制器,基于 CAN 總線的汽車發(fā)動機智能電子控制器,GPS 導航系統(tǒng),abs 防抱死系統(tǒng),制動系統(tǒng)等等。
此外,單片機在工商,金融,科研、教育,國防航空航天等領域都有著十分廣泛的用途。
收藏