1347-基于單片機(jī)的數(shù)控車床XY工作臺(tái)與控制系統(tǒng)設(shè)計(jì)
1347-基于單片機(jī)的數(shù)控車床XY工作臺(tái)與控制系統(tǒng)設(shè)計(jì),基于,單片機(jī),數(shù)控車床,xy,工作臺(tái),控制系統(tǒng),設(shè)計(jì)
湘潭大學(xué)興湘學(xué)院畢業(yè)論文(設(shè)計(jì))任務(wù)書論文(設(shè)計(jì))題目:基于單片機(jī)的數(shù)控車床 XY 工作臺(tái)與控制系統(tǒng)設(shè)計(jì) 學(xué)號(hào): 2006183819 姓名: 蔣迎龍 專業(yè):機(jī)械設(shè)計(jì)制造及其自動(dòng)化 指導(dǎo)教師: 系主任: 一、主要內(nèi)容及基本要求 1、設(shè)計(jì)基于單片機(jī)的數(shù)控車床 XY 工作臺(tái)與控制系統(tǒng),定位精度:±0.01mm,要求能實(shí)現(xiàn)工作臺(tái) X 和 Y 方向的運(yùn)動(dòng)以及直線和圓弧插補(bǔ)等基本控制功能。 2、機(jī)械結(jié)構(gòu)圖多張,其中裝配圖 A0 圖紙 1 張。 3、控制電路圖一張。 4、繪制單片機(jī)控制原理圖并編寫單片機(jī)控制程序,要求邏輯清晰,簡(jiǎn)單明了,可讀性強(qiáng)。 5、說(shuō)明書一份,要求條例性強(qiáng),語(yǔ)句通順,無(wú)錯(cuò)別字,不少于 25 頁(yè)。 6、英文文獻(xiàn)翻譯一份,不少于 3000 字。 二、重點(diǎn)研究的問(wèn)題1、數(shù)控裝置總體方案的設(shè)計(jì)。 2、機(jī)械部分的設(shè)計(jì)。 3、數(shù)控系統(tǒng)的設(shè)計(jì)。 三、進(jìn)度安排序號(hào) 各階段完成的內(nèi)容 完成時(shí)間1 查閱資料、調(diào)研 1-3 周2 開(kāi)題報(bào)告、制訂設(shè)計(jì)方案 4 周3 機(jī)械設(shè)計(jì) 5-7 周4 電路設(shè)計(jì)、編寫程序 8-10 周5 翻譯 11 周6 撰寫論文 11-13 周7 修改,寫出正式稿 14 周8 答辯 15 周四、應(yīng)收集的資料及主要參考文獻(xiàn)1.濮良貴,紀(jì)名剛.機(jī)械設(shè)計(jì)[M].北京:高等教育出版社,2005. 2.成大先.機(jī)械設(shè)計(jì)手冊(cè)[M].北京:化學(xué)工業(yè)出版社,1992. 3.徐元昌.?dāng)?shù)控技術(shù)[M].北京:中國(guó)輕工業(yè)出版社,2004. 4.文懷興,廈田.?dāng)?shù)控機(jī)床系統(tǒng)設(shè)計(jì)[M].北京:化學(xué)工業(yè)出版社,2005. 5. 鄭堤,唐可洪.機(jī)電一體化設(shè)計(jì)基礎(chǔ)[M].北京:機(jī)械工業(yè)出版社,1997. 6.汪道輝.單片機(jī)系統(tǒng)設(shè)計(jì)與實(shí)踐[M].北京:電子工業(yè)出版社,2006. 單片機(jī)單片機(jī)即單片微型計(jì)算機(jī),是把中央處理器、存儲(chǔ)器、定時(shí)/計(jì)數(shù)器、輸入輸出接口都集成在一塊集成電路芯片上的微型計(jì)算機(jī)。與應(yīng)用在個(gè)人電腦中的通用型微處理器相比,它更強(qiáng)調(diào)自供應(yīng)(不用外接硬件)和節(jié)約成本。它的最大優(yōu)點(diǎn)是體積小,可放在儀表內(nèi)部,但存儲(chǔ)量小,輸入輸出接口簡(jiǎn)單,功能較低。由于其發(fā)展非常迅速,舊的單片機(jī)的定義已不能滿足,所以在很多應(yīng)用場(chǎng)合被稱為范圍更廣的微控制器,但是目前在中國(guó)大陸仍多沿用“單片機(jī)”的稱呼。絕大多數(shù)現(xiàn)在的單片機(jī)都是基于馮·諾伊曼結(jié)構(gòu)的,這種結(jié)構(gòu)清楚地定義了嵌入式系統(tǒng)所必需的四個(gè)基本部分:一個(gè)中央處理器核心,程序存儲(chǔ)器(只讀存儲(chǔ)器或者閃存) 、數(shù)據(jù)存儲(chǔ)器(隨機(jī)存儲(chǔ)器) ,一個(gè)或者更多的定時(shí)/計(jì)時(shí)器,還有用來(lái)與外圍設(shè)備以及擴(kuò)展資源進(jìn)行通信的輸入/ 輸出端口——所有這些都被集成在單個(gè)集成電路芯片上。說(shuō)單片機(jī)與通用型中央處理單元芯片不同是因?yàn)榍罢咭话愫苋菀着浜献钚⌒偷耐獠恐С中酒瞥晒ぷ饔?jì)算機(jī)。這樣就可以很容易的把單片機(jī)系統(tǒng)植入裝置內(nèi)部來(lái)控制裝置了。近年來(lái)為了在指令和數(shù)據(jù)上使用不同的字寬,并提高處理器流水線速度,哈佛結(jié)構(gòu)在微控制器和 DSP 也逐漸得到了廣泛的應(yīng)用。 傳統(tǒng)的微處理器是不允許這么做的。它要完成單片機(jī)的工作,就必須連接一些其他芯片。比如說(shuō),因?yàn)槠蠜](méi)有數(shù)據(jù)存儲(chǔ)器,就必須要添加一些 RAM的存儲(chǔ)芯片,雖然所添加存儲(chǔ)器的容量很靈活,但是至少還是要添加,另外還需要添加很多連線來(lái)傳遞芯片之間的數(shù)據(jù)。 比如,一個(gè)典型的微控制器只需要一個(gè)時(shí)鐘發(fā)生器和很少的 RAM 和 ROM(或者 EPROM, E2PROM)就可以在軟件和晶振下工作了。同時(shí),微控制器具有豐富的輸入輸出設(shè)備,像是模擬數(shù)字轉(zhuǎn)換(ADC),定時(shí)器,串口或者其他串行通訊接口(比如 I2C,串行外圍接口(SPI),控制器局域網(wǎng))。通常,這些繼承在內(nèi)部的設(shè)備可以通過(guò)特殊的指令來(lái)操作。 一些現(xiàn)代的微控制器支持一些內(nèi)建的高級(jí)編程語(yǔ)言,比如 BASIC 語(yǔ)言。早期的單片機(jī)都是 8 位或 4 位的。其中最成功的是 INTEL 的 8031,因?yàn)楹?jiǎn)單可靠而性能不錯(cuò)獲得了很大的好評(píng)。此后在 8031 上發(fā)展出了 MCS51 系列單片機(jī)系統(tǒng)?;谶@一系統(tǒng)的單片機(jī)系統(tǒng)直到現(xiàn)在還在廣泛使用。隨著工業(yè)控制領(lǐng)域要求的提高,開(kāi)始出現(xiàn)了 16 位單片機(jī),但因?yàn)樾詢r(jià)比不理想并未得到很廣泛的應(yīng)用。90 年代后隨著消費(fèi)電子產(chǎn)品大發(fā)展,單片機(jī)技術(shù)得到了巨大的提高。隨著 INTEL i960 系列特別是后來(lái)的 ARM 系列的廣泛應(yīng)用,32 位單片機(jī)迅速取代 16 位單片機(jī)的高端地位,并且進(jìn)入主流市場(chǎng)。而傳統(tǒng)的 8 位單片機(jī)的性能也得到了飛速提高,處理能力比起 80 年代提高了數(shù)百倍。目前,高端的 32位單片機(jī)主頻已經(jīng)超過(guò) 300MHz,性能直追 90 年代中期的專用處理器,而普通的型號(hào)出廠價(jià)格跌落至 1 美元,最高端的型號(hào)也只有 10 美元。當(dāng)代單片機(jī)系統(tǒng)已經(jīng)不再只在裸機(jī)環(huán)境下開(kāi)發(fā)和使用,大量專用的嵌入式操作系統(tǒng)被廣泛應(yīng)用在全系列的單片機(jī)上。而在作為掌上電腦和手機(jī)核心處理的高端單片機(jī)甚至可以直接使用專用的 Windows 和 Linux 操作系統(tǒng)。單片機(jī)比專用處理器最適合應(yīng)用于嵌入式系統(tǒng),因此它得到了最多的應(yīng)用。事實(shí)上單片機(jī)是世界上數(shù)量最多的計(jì)算機(jī)?,F(xiàn)代人類生活中所用的幾乎每件電子和機(jī)械產(chǎn)品中都會(huì)集成有單片機(jī)。手機(jī)、電話、計(jì)算器、家用電器、電子玩具、掌上電腦以及鼠標(biāo)等電腦配件中都配有 1-2 部單片機(jī)。而個(gè)人電腦中也會(huì)有為數(shù)不少的單片機(jī)在工作。汽車上一般配備 40 多部單片機(jī),復(fù)雜的工業(yè)控制系統(tǒng)上甚至可能有數(shù)百臺(tái)單片機(jī)在同時(shí)工作!單片機(jī)的數(shù)量不僅遠(yuǎn)超過(guò) PC 機(jī)和其他計(jì)算的綜合,甚至比人類的數(shù)量還要多。單片機(jī)學(xué)習(xí)應(yīng)中的五大重要部分:一、總線:我們知道,一個(gè)電路總是由元器件通過(guò)電線連接而成的,在模擬電路中,連線并不成為一個(gè)問(wèn)題,因?yàn)楦髌骷g一般是串行關(guān)系,各器件之間的連線并不很多,但計(jì)算機(jī)電路卻不一樣,它是以微處理器為核心,各器件都要與微處理器相連,各器件之間的工作必須相互協(xié)調(diào),所以就需要的連線就很多了,如果仍如同模擬電路一樣,在各微處理器和各器件間單獨(dú)連線,則線的數(shù)量將多得驚人,所以在微處理機(jī)中引入了總線的概念,各個(gè)器件共同享用連線,所有器件的 8 根數(shù)據(jù)線全部接到 8 根公用的線上,即相當(dāng)于各個(gè)器件并聯(lián)起來(lái),但僅這樣還不行,如果有兩個(gè)器件同時(shí)送出數(shù)據(jù),一個(gè)為 0,一個(gè)為1,那么,接收方接收到的究竟是什么呢?這種情況是不允許的,所以要通過(guò)控制線進(jìn)行控制,使器件分時(shí)工作,任何時(shí)候只能有一個(gè)器件發(fā)送數(shù)據(jù)(可以有多個(gè)器件同時(shí)接收)。器件的數(shù)據(jù)線也就被稱為數(shù)據(jù)總線,器件所有的控制線被稱為控制總線。在單片機(jī)內(nèi)部或者外部存儲(chǔ)器及其它器件中有存儲(chǔ)單元,這些存儲(chǔ)單元要被分配地址,才能使用,分配地址當(dāng)然也是以電信號(hào)的形式給出的,由于存儲(chǔ)單元比較多,所以,用于地址分配的線也較多,這些線被稱為地址總線。二、數(shù)據(jù)、地址、指令:之所以將這三者放在一起,是因?yàn)檫@三者的本質(zhì)都是一樣的——數(shù)字,或者說(shuō)都是一串‘0’和‘1’組成的序列。換言之,地址、指令也都是數(shù)據(jù)。指令:由單片機(jī)芯片的設(shè)計(jì)者規(guī)定的一種數(shù)字,它與我們常用的指令助記符有著嚴(yán)格的一一對(duì)應(yīng)關(guān)系,不可以由單片機(jī)的開(kāi)發(fā)者更改。地址:是尋找單片機(jī)內(nèi)部、外部的存儲(chǔ)單元、輸入輸出口的依據(jù),內(nèi)部單元的地址值已由芯片設(shè)計(jì)者規(guī)定好,不可更改,外部的單元可以由單片機(jī)開(kāi)發(fā)者自行決定,但有一些地址單元是一定要有的(詳見(jiàn)程序的執(zhí)行過(guò)程)。數(shù)據(jù):這是由微處理機(jī)處理的對(duì)象,在各種不同的應(yīng)用電路中各不相同,一般而言,被處理的數(shù)據(jù)可能有這么幾種情況: 1、地址(如 MOV DPTR,#1000H),即地址 1000H 送入 DPTR。 2、方式字或控制字(如 MOV TMOD,#3 ),3 即是控制字。 3、常數(shù)(如 MOV TH0,#10H)10H 即定時(shí)常數(shù)。 4、實(shí)際輸出值(如 P1 口接彩燈,要燈全亮,則執(zhí)行指令:MOV P1, #0FFH,要燈全暗,則執(zhí)行指令:MOV P1,#00H)這里 0FFH 和 00H都是實(shí)際輸出值。又如用于 LED 的字形碼,也是實(shí)際輸出的值。 理解了地址、指令的本質(zhì),就不難理解程序運(yùn)行過(guò)程中為什么會(huì)跑飛,會(huì)把數(shù)據(jù)當(dāng)成指令來(lái)執(zhí)行了。三、P0 口、P2 口和 P3 的第二功能用法:初學(xué)時(shí)往往對(duì) P0 口、P2 口和 P3口的第二功能用法迷惑不解,認(rèn)為第二功能和原功能之間要有一個(gè)切換的過(guò)程,或者說(shuō)要有一條指令,事實(shí)上,各端口的第二功能完全是自動(dòng)的,不需要用指令來(lái)轉(zhuǎn)換。如 P3.6、P3.7 分別是 WR、RD 信號(hào),當(dāng)微片理機(jī)外接 RAM 或有外部 I/O 口時(shí),它們被用作第二功能,不能作為通用 I/O 口使用,只要一微處理機(jī)一執(zhí)行到 MOVX 指令,就會(huì)有相應(yīng)的信號(hào)從 P3.6 或 P3.7 送出,不需要事先用指令說(shuō)明。事實(shí)上‘不能作為通用 I/O 口使用’也并不是‘不能’而是(使用者)‘不會(huì)’將其作為通用 I/O 口使用。你完全可以在指令中按排一條 SETB P3.7 的指令,并且當(dāng)單片機(jī)執(zhí)行到這條指令時(shí),也會(huì)使 P3.7 變?yōu)楦唠娖?,但使用者不?huì)這么去做,因?yàn)檫@通常這會(huì)導(dǎo)致系統(tǒng)的崩潰。四、程序的執(zhí)行過(guò)程: 單片機(jī)在通電復(fù)位后 8051 內(nèi)的程序計(jì)數(shù)器(PC )中的值為‘0000’ ,所以程序總是從‘0000’ 單元開(kāi)始執(zhí)行,也就是說(shuō):在系統(tǒng)的ROM 中一定要存在‘0000’這個(gè)單元,并且在‘0000’單元中存放的一定是一條指令。五、堆棧:堆棧是一個(gè)區(qū)域,是用來(lái)存放數(shù)據(jù)的,這個(gè)區(qū)域本身沒(méi)有任何特殊之處,就是內(nèi)部 RAM 的一部份,特殊的是它存放和取用數(shù)據(jù)的方式,即所謂的‘ 先進(jìn)后出,后進(jìn)先出’,并且堆棧有特殊的數(shù)據(jù)傳輸指令,即‘PUSH’和‘POP’,有一個(gè)特殊的專為其服務(wù)的單元,即堆棧指針 SP,每當(dāng)執(zhí)一次 PUSH指令時(shí),SP 就(在原值的基礎(chǔ)上)自動(dòng)加 1,每當(dāng)執(zhí)行一次 POP 指令,SP 就(在原值的基礎(chǔ)上)自動(dòng)減 1。由于 SP 中的值可以用指令加以改變,所以只要在程序開(kāi)始階段更改了 SP 的值,就可以把堆棧設(shè)置在規(guī)定的內(nèi)存單元中,如在程序開(kāi)始時(shí),用一條 MOV SP,#5FH 指令,就時(shí)把堆棧設(shè)置在從內(nèi)存單元60H 開(kāi)始的單元中。一般程序的開(kāi)頭總有這么一條設(shè)置堆棧指針的指令,因?yàn)殚_(kāi)機(jī)時(shí),SP 的初始值為 07H,這樣就使堆棧從 08H 單元開(kāi)始往后,而 08H 到1FH 這個(gè)區(qū)域正是 8031 的第二、三、四工作寄存器區(qū),經(jīng)常要被使用,這會(huì)造成數(shù)據(jù)的混亂。不同作者編寫程序時(shí),初始化堆棧指令也不完全相同,這是作者的習(xí)慣問(wèn)題。當(dāng)設(shè)置好堆棧區(qū)后,并不意味著該區(qū)域成為一種專用內(nèi)存,它還是可以象普通內(nèi)存區(qū)域一樣使用,只是一般情況下編程者不會(huì)把它當(dāng)成普通內(nèi)存用。Single Chip Microcomputer A microcontroller (or MCU) is a computer-on-a-chip. It is a type of microprocessor emphasizing self-sufficiency and cost-effectiveness, in contrast to a general-purpose microprocessor (the kind used in a PC). The majority of computer systems in use today are embedded in other machinery, such as telephones, clocks, appliances, vehicles, and infrastructure. An embedded system usually has minimal requirements for memory and program length and may require simple but unusual input/output systems. For example, most embedded systems lack keyboards, screens, disks, printers, or other recognizable I/O devices of a personal computer. They may control electric motors, relays or voltages, and read switches, variable resistors or other electronic devices. Often, the only I/O device readable by a human is a single light-emitting diode, and severe cost or power constraints can even eliminate that. In contrast to general-purpose CPUs, microcontrollers do not have an address bus or a data bus, because they integrate all the RAM and non-volatile memory on the same chip as the CPU. Because they need fewer pins, the chip can be placed in a much smaller, cheaper package. Integrating the memory and other peripherals on a single chip and testing them as a unit increases the cost of that chip, but often results in decreased net cost of the embedded system as a whole. (Even if the cost of a CPU that has integrated peripherals is slightly more than the cost of a CPU + external peripherals, having fewer chips typically allows a smaller and cheaper circuit board, and reduces the labor required to assemble and test the circuit board). This trend leads to design. A microcontroller is a single integrated circuit, commonly with the following features: central processing unit - ranging from small and simple 4-bit processors to sophisticated 32- or 64-bit processors input/output interfaces such as serial ports (UARTs) other serial communications interfaces like I2C, Serial Peripheral Interface and Controller Area Network for system interconnect peripherals such as timers and watchdog RAM for data storage ROM, EPROM, EEPROM or Flash memory for program storage clock generator - often an oscillator for a quartz timing crystal, resonator or RC circuit many include analog-to-digital converters This integration drastically reduces the number of chips and the amount of wiring and PCB space that would be needed to produce equivalent systems using separate chips and have proved to be highly popular in embedded systems since their introduction in the 1970s. Some microcontrollers can afford to use a Harvard architecture: separate memory buses for instructions and data, allowing accesses to take place concurrently. The single slice of the earlier period all of machines are 8 or 4.Among them, the INTEL is most successful of 8031, because of in brief dependable but the function was quite good to acquire very big good opinion.Henceforth at 8031 up developed MCS51 serieses a single slice machine system.According to the single slice of this system machine system is still in the extensive usage till now.Because the industry controls the exaltation of[with] realm request, starting appearing 16 single slice machine, but because sex price wanted to don't get a very extensive application than the disregard.Develop greatly along with the consumption electronics product after 90's, the single slice machine technique got a huge exaltation.Along with the extensive application of INTEL i 960 serieses especially later ARM series, the 32 single slice machine replaces 16 single slice the high level position of the machine quickly, and gets into an essential market.And traditional of 8 single slice the function of the machine also got to fly to raise soon, handling an ability to compare with to raise few a hundredfolds in 80's.Currently, 32 single slice of the high level with main machine already over 300 MHzs, the function keeps appropriation processor of making track for the mid 90's, and the common model number factory price drop into to USD 1, tallest carry of model number also only USD 10.The contemporary and single slice machine system has already no longer developed and used just under the naked machine environment, the in great quantities appropriative built-in operate system is applied extensively in the whole serieseses of the single slice is on board.But Be ising the high level of handheld PC and cellular phone core processing single slice the machine even can use appropriative Windows and the Linux operate system directly. Single slice the machine ratio appropriation processor is the most suitable to match to apply in the built-in system, so it got the most applications.In fact the single slice machine is an amount the most calculators are in the world.The modern mankind are living medium use of.assemble in almost each electronics and machine product have a single slice machine.All have 1-2 single slice machine in the computer accessorieses such as cellular phone, telephone, calculator, home appliances, electronics toy, handheld PC and mouse etc..And personal computer in would also capable number not a few single slice the machine be working.Provide with more than 40 departments a single slice machine generally on the car, complicated industry's controling the top of the system even may has single several hundred pedestalses slices machine to work in the meantime!Single slice the amount of the machine not only far above the PC machine and other calculations of comprehensive, even than the mankind's amount still want have another Singlechip study should be an important part in the five: First, the bus: we know that a circuit is always from the components through wires connected, and in analog circuits, the connection does not become a problem, because the devices are generally serial inter-relationship between the various devices connection is not much, but not the same as computer circuits, which is based on the microprocessor as the core, the device must be connected with the microprocessor, the device must be between the mutual coordination and so on need to connect on a lot of If still the same as analog circuits, in the microprocessor and a separate connection between the devices, the quantity line will be many alarmingly so in the microprocessor introduced the concept of bus, all devices share the connection All devices of all eight data lines from eight public online, which is equivalent to all devices in parallel, but only this is not enough, if there is two devices send data simultaneously, a 0, a 1, then , the receiving party received what is it? This situation is not allowed, so to pass the line of control to control the device time job, any time there can be only one device to send data (which may have multiple devices simultaneously receiving). Device's data lines will be referred to as data bus, all the line of control devices known as control bus. Singlechip at internal or external memory and other devices have memory cells, these memory cells to be assigned addresses to use, the allocation of addresses is of course to give the form of electrical signals, and because memory cells are more so for address the allocation of more lines, these lines were known as the address bus. Second, data, address, command: The reason why these three together, because these three are the essence is the same - figure, or are a string of'0 'and'1', composed of sequence . In other words, addresses, instructions are also data. Command: from single-chip chip designer provides a figure, it is consistent with our mnemonic commonly used commands have a strict one-to-one relationship, not by the developer to change the MCU. Address: Singlechip are looking for internal, external storage units, input and output port based on the value of the internal unit's address has been provided for the chip designers, and can not be changed, the external unit can be single-chip developers to decide, but Yes there is some address must be the unit (see procedures for the implementation process). Data: This is the object of treatment by the microprocessor, in a variety of different applications in different circuits, in general, the data may be processed so have several situations: 1 .address (such as MOV DPTR, # 1000H), that address 1000h into the DPTR. 2. the way the words or control characters (such as MOV TMOD, # 3), 3 which controls the characters. 3. constants (such as MOV TH0, # 10H) 10H that is constant from time to time. 4 .The actual output value (such as the mouth then P1 lantern light to light the whole, then the implementation of instruction: MOV P1, # 0FFH, to light the whole dark, then the implementation of instruction: MOV P1, # 00H) and 00H are here 0FFH actual output value. Another example is the font code for the LED, is the actual output value. Understanding of the address, the nature of instructions, running is not difficult to understand why the process of running fly, the data will be implemented as instructions. Three, P0 mouth, P2 and P3 the mouth of the second function Usage: often on P0 beginner I, P2 and P3 mouth I use the second function puzzled think the second function and the original features have a switch between the process, or that there have to be a directive, in fact, the port's second feature is completely automatic, no need to use command to convert. Such as P3.6, P3.7, respectively, are WR, RD signal, when the micro-chip RAM or external justifications machine has an external I / O port, they were used as the second function, can not be used as general-purpose I / O port to use, as long as one microprocessor implementation of the MOVX instruction 1, there will be a corresponding signal sent from the P3.6 or P3.7, no prior use instructions indicate. In fact 'can not be used as general-purpose I / O port use' is not 'should not' but (user) 'not' as a general-purpose I / O port to use. At command you can arrange a Medium of Instruction SETB P3.7, and when the single-chip implementation of this Article directions, P3.7 will also become high, but users will not do so, because This usually will lead to the collapse of the system. Four, the program implementation process: single-chip power-on reset in 8051 after the program counter (PC) in the value of'0000 ', so the procedure always'0000' unit begin implementation of, that is to say: the system's ROM must exist in the'0000 'in this unit, and'0000' in the storage unit must be a command. Five, the stack: the stack is a region, are used to store data, the region does not have any unique position, that is a part of internal RAM, special is its data storage and access methods, namely, the so-called 'advanced after that last-in first-out ', and the stack has a special data transmission command, ie' PUSH 'and' POP ', there is a special unit specifically for its services, that is, the stack pointer SP, when they first PUSH instruction, the SP on (at the original value of the foundation on) automatically add one, whenever the implementation of a POP instruction, SP on (at the original value basis) minus one automatically. Because of the value of SP can be used to change directions, so as long as the stage at the beginning of the proceedings to change the value of the SP, you can put the stack set up the required memory units, such as at the beginning of the proceedings, with a MOV SP, # 5FH instructions when put on the stack from the memory modules installed in the unit 60H start. The normal procedure at the beginning of the total that there is a stack pointer of the instruction set, because at startup, SP initial value of 07H, thus the stack from the beginning the next unit 08h, and 08h to 1Fh in the region 8031 is the second, Three, four working registers area, often used, this will lead to data chaos. The author has prepared a different program, not exactly the same instructions to initialize the stack, which is the author's customary problem. When set up the stack area, does not mean that the region as a dedicated memory, it can be as common as the use of memory region, but under normal circumstances programming will not put it as an ordinary memory use.
收藏