19基于單片機的數(shù)控車床XY工作臺與控制系統(tǒng)設(shè)計
19基于單片機的數(shù)控車床XY工作臺與控制系統(tǒng)設(shè)計,19,基于,單片機,數(shù)控車床,xy,工作臺,控制系統(tǒng),設(shè)計
湘潭大學(xué)興湘學(xué)院畢業(yè)論文(設(shè)計)任務(wù)書論文(設(shè)計)題目:基于單片機的數(shù)控車床 XY 工作臺與控制系統(tǒng)設(shè)計 學(xué)號: 2006183819 姓名: 蔣迎龍 專業(yè):機械設(shè)計制造及其自動化 指導(dǎo)教師: 系主任: 一、主要內(nèi)容及基本要求 1、設(shè)計基于單片機的數(shù)控車床 XY 工作臺與控制系統(tǒng),定位精度:±0.01mm,要求能實現(xiàn)工作臺 X 和 Y 方向的運動以及直線和圓弧插補等基本控制功能。 2、機械結(jié)構(gòu)圖多張,其中裝配圖 A0 圖紙 1 張。 3、控制電路圖一張。 4、繪制單片機控制原理圖并編寫單片機控制程序,要求邏輯清晰,簡單明了,可讀性強。 5、說明書一份,要求條例性強,語句通順,無錯別字,不少于 25 頁。 6、英文文獻(xiàn)翻譯一份,不少于 3000 字。 二、重點研究的問題1、數(shù)控裝置總體方案的設(shè)計。 2、機械部分的設(shè)計。 3、數(shù)控系統(tǒng)的設(shè)計。 三、進(jìn)度安排序號 各階段完成的內(nèi)容 完成時間1 查閱資料、調(diào)研 1-3 周2 開題報告、制訂設(shè)計方案 4 周3 機械設(shè)計 5-7 周4 電路設(shè)計、編寫程序 8-10 周5 翻譯 11 周6 撰寫論文 11-13 周7 修改,寫出正式稿 14 周8 答辯 15 周四、應(yīng)收集的資料及主要參考文獻(xiàn)1.濮良貴,紀(jì)名剛.機械設(shè)計[M].北京:高等教育出版社,2005. 2.成大先.機械設(shè)計手冊[M].北京:化學(xué)工業(yè)出版社,1992. 3.徐元昌.?dāng)?shù)控技術(shù)[M].北京:中國輕工業(yè)出版社,2004. 4.文懷興,廈田.?dāng)?shù)控機床系統(tǒng)設(shè)計[M].北京:化學(xué)工業(yè)出版社,2005. 5. 鄭堤,唐可洪.機電一體化設(shè)計基礎(chǔ)[M].北京:機械工業(yè)出版社,1997. 6.汪道輝.單片機系統(tǒng)設(shè)計與實踐[M].北京:電子工業(yè)出版社,2006. 湘潭大學(xué)興湘學(xué)院畢業(yè)設(shè)計說明書題 目:基于單片機的數(shù)控車床 XY 工作臺與控制系統(tǒng)設(shè)計 專 業(yè): 機械設(shè)計制造及其自動化 學(xué) 號: 2006183819 姓 名: 蔣迎龍 指導(dǎo)教師: 劉習(xí)文 完成日期: 2010 年 5 月 31 日 湘潭大學(xué)興湘學(xué)院目 錄摘 要 ………………………………………………………………………………………1第一章 緒論 ……………………………………………………………………………………21.1 數(shù)控機床的生產(chǎn)與發(fā)展………………………………………………………………21.2 數(shù)控機床的發(fā)展趨勢…………………………………………………………………21.3 數(shù)控機床在先進(jìn)制造技術(shù)中的作用………………………………………………31.4 對我國數(shù)控技術(shù)及其產(chǎn)業(yè)發(fā)展的基本估計 ……………………………………31.5 畢業(yè)設(shè)計的目的、意義………………………………………………………………31.6 畢業(yè)設(shè)計的內(nèi)容………………………………………………………………………4第二章 數(shù)控系統(tǒng)總體方案的確定 ………………………………………………………51.1 系統(tǒng)運動方式的確定 ……………………………………………………………………51.2 伺服系統(tǒng)的選擇 …………………………………………………………………………51.3 計算機系統(tǒng)的選擇 ………………………………………………………………………51.4 X-Y 工作臺的傳動方式 …………………………………………………………………5第三章 機械部分設(shè)計 ………………………………………………………………………71.1 確定系統(tǒng)脈沖當(dāng)量 ………………………………………………………………………71.2 工作臺外形尺寸及重量初步估算 ………………………………………………………71.3 滾動導(dǎo)軌副的計算、選擇 ………………………………………………………………81.4 滾珠絲杠計算、選擇 ……………………………………………………………………91.5 齒輪計算、設(shè)計 …………………………………………………………………………121.6 步進(jìn)電機慣性負(fù)載的計算以及步進(jìn)電機的選用………………………………………13第四章 數(shù)控系統(tǒng)硬件電路設(shè)計 …………………………………………………………151.1 數(shù)控系統(tǒng)的硬件電路由以下幾部分組成………………………………………………151.2 主控制器CPU的選擇…………………………………………………………………151.3 存儲器擴展電路設(shè)計……………………………………………………………………16第五章 系統(tǒng)控制軟件的設(shè)計 …………………………………………………171.1 系統(tǒng)控制功能分析………………………………………………………………………171.2 系統(tǒng)管理程序控制………………………………………………………………………171.3 自動加工程序設(shè)計………………………………………………………………………181.4 匯編語言程序設(shè)計………………………………………………………………………19第六章 結(jié)束語與致謝 …………………………………………………………25參考資料 ………………………………………………………………………………………26單片機單片機即單片微型計算機,是把中央處理器、存儲器、定時/計數(shù)器、輸入輸出接口都集成在一塊集成電路芯片上的微型計算機。與應(yīng)用在個人電腦中的通用型微處理器相比,它更強調(diào)自供應(yīng)(不用外接硬件)和節(jié)約成本。它的最大優(yōu)點是體積小,可放在儀表內(nèi)部,但存儲量小,輸入輸出接口簡單,功能較低。由于其發(fā)展非常迅速,舊的單片機的定義已不能滿足,所以在很多應(yīng)用場合被稱為范圍更廣的微控制器,但是目前在中國大陸仍多沿用“單片機”的稱呼。絕大多數(shù)現(xiàn)在的單片機都是基于馮·諾伊曼結(jié)構(gòu)的,這種結(jié)構(gòu)清楚地定義了嵌入式系統(tǒng)所必需的四個基本部分:一個中央處理器核心,程序存儲器(只讀存儲器或者閃存) 、數(shù)據(jù)存儲器(隨機存儲器) ,一個或者更多的定時/計時器,還有用來與外圍設(shè)備以及擴展資源進(jìn)行通信的輸入/ 輸出端口——所有這些都被集成在單個集成電路芯片上。說單片機與通用型中央處理單元芯片不同是因為前者一般很容易配合最小型的外部支持芯片制成工作計算機。這樣就可以很容易的把單片機系統(tǒng)植入裝置內(nèi)部來控制裝置了。近年來為了在指令和數(shù)據(jù)上使用不同的字寬,并提高處理器流水線速度,哈佛結(jié)構(gòu)在微控制器和 DSP 也逐漸得到了廣泛的應(yīng)用。 傳統(tǒng)的微處理器是不允許這么做的。它要完成單片機的工作,就必須連接一些其他芯片。比如說,因為片上沒有數(shù)據(jù)存儲器,就必須要添加一些 RAM的存儲芯片,雖然所添加存儲器的容量很靈活,但是至少還是要添加,另外還需要添加很多連線來傳遞芯片之間的數(shù)據(jù)。 比如,一個典型的微控制器只需要一個時鐘發(fā)生器和很少的 RAM 和 ROM(或者 EPROM, E2PROM)就可以在軟件和晶振下工作了。同時,微控制器具有豐富的輸入輸出設(shè)備,像是模擬數(shù)字轉(zhuǎn)換(ADC),定時器,串口或者其他串行通訊接口(比如 I2C,串行外圍接口(SPI),控制器局域網(wǎng))。通常,這些繼承在內(nèi)部的設(shè)備可以通過特殊的指令來操作。 一些現(xiàn)代的微控制器支持一些內(nèi)建的高級編程語言,比如 BASIC 語言。早期的單片機都是 8 位或 4 位的。其中最成功的是 INTEL 的 8031,因為簡單可靠而性能不錯獲得了很大的好評。此后在 8031 上發(fā)展出了 MCS51 系列單片機系統(tǒng)。基于這一系統(tǒng)的單片機系統(tǒng)直到現(xiàn)在還在廣泛使用。隨著工業(yè)控制領(lǐng)域要求的提高,開始出現(xiàn)了 16 位單片機,但因為性價比不理想并未得到很廣泛的應(yīng)用。90 年代后隨著消費電子產(chǎn)品大發(fā)展,單片機技術(shù)得到了巨大的提高。隨著 INTEL i960 系列特別是后來的 ARM 系列的廣泛應(yīng)用,32 位單片機迅速取代 16 位單片機的高端地位,并且進(jìn)入主流市場。而傳統(tǒng)的 8 位單片機的性能也得到了飛速提高,處理能力比起 80 年代提高了數(shù)百倍。目前,高端的 32位單片機主頻已經(jīng)超過 300MHz,性能直追 90 年代中期的專用處理器,而普通的型號出廠價格跌落至 1 美元,最高端的型號也只有 10 美元。當(dāng)代單片機系統(tǒng)已經(jīng)不再只在裸機環(huán)境下開發(fā)和使用,大量專用的嵌入式操作系統(tǒng)被廣泛應(yīng)用在全系列的單片機上。而在作為掌上電腦和手機核心處理的高端單片機甚至可以直接使用專用的 Windows 和 Linux 操作系統(tǒng)。單片機比專用處理器最適合應(yīng)用于嵌入式系統(tǒng),因此它得到了最多的應(yīng)用。事實上單片機是世界上數(shù)量最多的計算機?,F(xiàn)代人類生活中所用的幾乎每件電子和機械產(chǎn)品中都會集成有單片機。手機、電話、計算器、家用電器、電子玩具、掌上電腦以及鼠標(biāo)等電腦配件中都配有 1-2 部單片機。而個人電腦中也會有為數(shù)不少的單片機在工作。汽車上一般配備 40 多部單片機,復(fù)雜的工業(yè)控制系統(tǒng)上甚至可能有數(shù)百臺單片機在同時工作!單片機的數(shù)量不僅遠(yuǎn)超過 PC 機和其他計算的綜合,甚至比人類的數(shù)量還要多。單片機學(xué)習(xí)應(yīng)中的五大重要部分:一、總線:我們知道,一個電路總是由元器件通過電線連接而成的,在模擬電路中,連線并不成為一個問題,因為各器件間一般是串行關(guān)系,各器件之間的連線并不很多,但計算機電路卻不一樣,它是以微處理器為核心,各器件都要與微處理器相連,各器件之間的工作必須相互協(xié)調(diào),所以就需要的連線就很多了,如果仍如同模擬電路一樣,在各微處理器和各器件間單獨連線,則線的數(shù)量將多得驚人,所以在微處理機中引入了總線的概念,各個器件共同享用連線,所有器件的 8 根數(shù)據(jù)線全部接到 8 根公用的線上,即相當(dāng)于各個器件并聯(lián)起來,但僅這樣還不行,如果有兩個器件同時送出數(shù)據(jù),一個為 0,一個為1,那么,接收方接收到的究竟是什么呢?這種情況是不允許的,所以要通過控制線進(jìn)行控制,使器件分時工作,任何時候只能有一個器件發(fā)送數(shù)據(jù)(可以有多個器件同時接收)。器件的數(shù)據(jù)線也就被稱為數(shù)據(jù)總線,器件所有的控制線被稱為控制總線。在單片機內(nèi)部或者外部存儲器及其它器件中有存儲單元,這些存儲單元要被分配地址,才能使用,分配地址當(dāng)然也是以電信號的形式給出的,由于存儲單元比較多,所以,用于地址分配的線也較多,這些線被稱為地址總線。二、數(shù)據(jù)、地址、指令:之所以將這三者放在一起,是因為這三者的本質(zhì)都是一樣的——數(shù)字,或者說都是一串‘0’和‘1’組成的序列。換言之,地址、指令也都是數(shù)據(jù)。指令:由單片機芯片的設(shè)計者規(guī)定的一種數(shù)字,它與我們常用的指令助記符有著嚴(yán)格的一一對應(yīng)關(guān)系,不可以由單片機的開發(fā)者更改。地址:是尋找單片機內(nèi)部、外部的存儲單元、輸入輸出口的依據(jù),內(nèi)部單元的地址值已由芯片設(shè)計者規(guī)定好,不可更改,外部的單元可以由單片機開發(fā)者自行決定,但有一些地址單元是一定要有的(詳見程序的執(zhí)行過程)。數(shù)據(jù):這是由微處理機處理的對象,在各種不同的應(yīng)用電路中各不相同,一般而言,被處理的數(shù)據(jù)可能有這么幾種情況: 1、地址(如 MOV DPTR,#1000H),即地址 1000H 送入 DPTR。 2、方式字或控制字(如 MOV TMOD,#3 ),3 即是控制字。 3、常數(shù)(如 MOV TH0,#10H)10H 即定時常數(shù)。 4、實際輸出值(如 P1 口接彩燈,要燈全亮,則執(zhí)行指令:MOV P1, #0FFH,要燈全暗,則執(zhí)行指令:MOV P1,#00H)這里 0FFH 和 00H都是實際輸出值。又如用于 LED 的字形碼,也是實際輸出的值。 理解了地址、指令的本質(zhì),就不難理解程序運行過程中為什么會跑飛,會把數(shù)據(jù)當(dāng)成指令來執(zhí)行了。三、P0 口、P2 口和 P3 的第二功能用法:初學(xué)時往往對 P0 口、P2 口和 P3口的第二功能用法迷惑不解,認(rèn)為第二功能和原功能之間要有一個切換的過程,或者說要有一條指令,事實上,各端口的第二功能完全是自動的,不需要用指令來轉(zhuǎn)換。如 P3.6、P3.7 分別是 WR、RD 信號,當(dāng)微片理機外接 RAM 或有外部 I/O 口時,它們被用作第二功能,不能作為通用 I/O 口使用,只要一微處理機一執(zhí)行到 MOVX 指令,就會有相應(yīng)的信號從 P3.6 或 P3.7 送出,不需要事先用指令說明。事實上‘不能作為通用 I/O 口使用’也并不是‘不能’而是(使用者)‘不會’將其作為通用 I/O 口使用。你完全可以在指令中按排一條 SETB P3.7 的指令,并且當(dāng)單片機執(zhí)行到這條指令時,也會使 P3.7 變?yōu)楦唠娖剑褂谜卟粫@么去做,因為這通常這會導(dǎo)致系統(tǒng)的崩潰。四、程序的執(zhí)行過程: 單片機在通電復(fù)位后 8051 內(nèi)的程序計數(shù)器(PC )中的值為‘0000’ ,所以程序總是從‘0000’ 單元開始執(zhí)行,也就是說:在系統(tǒng)的ROM 中一定要存在‘0000’這個單元,并且在‘0000’單元中存放的一定是一條指令。五、堆棧:堆棧是一個區(qū)域,是用來存放數(shù)據(jù)的,這個區(qū)域本身沒有任何特殊之處,就是內(nèi)部 RAM 的一部份,特殊的是它存放和取用數(shù)據(jù)的方式,即所謂的‘ 先進(jìn)后出,后進(jìn)先出’,并且堆棧有特殊的數(shù)據(jù)傳輸指令,即‘PUSH’和‘POP’,有一個特殊的專為其服務(wù)的單元,即堆棧指針 SP,每當(dāng)執(zhí)一次 PUSH指令時,SP 就(在原值的基礎(chǔ)上)自動加 1,每當(dāng)執(zhí)行一次 POP 指令,SP 就(在原值的基礎(chǔ)上)自動減 1。由于 SP 中的值可以用指令加以改變,所以只要在程序開始階段更改了 SP 的值,就可以把堆棧設(shè)置在規(guī)定的內(nèi)存單元中,如在程序開始時,用一條 MOV SP,#5FH 指令,就時把堆棧設(shè)置在從內(nèi)存單元60H 開始的單元中。一般程序的開頭總有這么一條設(shè)置堆棧指針的指令,因為開機時,SP 的初始值為 07H,這樣就使堆棧從 08H 單元開始往后,而 08H 到1FH 這個區(qū)域正是 8031 的第二、三、四工作寄存器區(qū),經(jīng)常要被使用,這會造成數(shù)據(jù)的混亂。不同作者編寫程序時,初始化堆棧指令也不完全相同,這是作者的習(xí)慣問題。當(dāng)設(shè)置好堆棧區(qū)后,并不意味著該區(qū)域成為一種專用內(nèi)存,它還是可以象普通內(nèi)存區(qū)域一樣使用,只是一般情況下編程者不會把它當(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.
收藏