【正文】
ABBBCCCDDDAAAB, (步距角為 度)。 因而不同的場(chǎng)合采取不同的的驅(qū)動(dòng)方式,到目前為止,驅(qū)動(dòng)方式一般有以下幾種:恒壓、恒壓串電阻、高低壓驅(qū)動(dòng)、恒流、細(xì)分 驅(qū)動(dòng) 等。一旦三大要素確定,步進(jìn)電機(jī)的型號(hào)便確定下來了。 相數(shù) : 4 電壓 : 12 V 電流 : 電阻 : 47Ω 最大靜轉(zhuǎn)距 : 180N 單片機(jī)控制步進(jìn)電機(jī)的升降頻 一些控制簡(jiǎn)單或要求低成本的運(yùn)動(dòng)控制系統(tǒng)中,經(jīng)常用步進(jìn)電機(jī)做執(zhí)行元件。因此步進(jìn)電機(jī)開環(huán)控制系統(tǒng)中,如何防止失步和過沖是開環(huán)控制系統(tǒng)能否正常運(yùn)行的關(guān)鍵。 失步和過沖現(xiàn)象分別出現(xiàn)在步進(jìn)電機(jī)啟動(dòng)和停止的時(shí)候。 實(shí)驗(yàn)表明,圖 13 所示的指數(shù)曲線是步進(jìn)電機(jī)最合理的升頻曲線,最符合電機(jī)和負(fù)載的慣性規(guī)律。為實(shí)現(xiàn)步進(jìn)電機(jī)的升降頻,在系統(tǒng)設(shè)計(jì)中,一般采 用硬件設(shè)計(jì)和軟件設(shè)計(jì),硬件使用積分電路和微分電路實(shí)現(xiàn),其元件參數(shù)一經(jīng)選定,曲線形狀就固定不變,因?yàn)槊總€(gè)電機(jī)及其負(fù)載的機(jī)械特性不同,所以他不能最好地與所有的電機(jī)適配。針對(duì)不同電機(jī)的機(jī)械特性,我們專門設(shè)計(jì)了一個(gè)數(shù)據(jù)區(qū),這個(gè)數(shù)據(jù)區(qū)中的數(shù)據(jù)即確定了指數(shù)曲線的形狀,我們改變電機(jī)時(shí),只要根據(jù)電機(jī)的特性改 變數(shù)據(jù)區(qū)的一些數(shù)據(jù),即可使曲線很好的與電機(jī)適配 [4]。 CPU 芯片 AT89C51 是主機(jī)板的核 心,接收各部分信息并向各部發(fā)出命令,控制電機(jī)運(yùn)行的各種工作狀態(tài)。 由于將多功能 8 位CPU 和閃爍存儲(chǔ)器組合在單個(gè)芯片中, 所以 ATMEL 的 AT89C51 是一種高效微控制器, 因其 高性能、高速度、體積小、價(jià)格低廉、穩(wěn)定可靠而得到廣泛應(yīng) 畢業(yè)設(shè)計(jì)(論文) 10 用 , 成為 在工業(yè)生產(chǎn)中必不可少的器件, 而且 在日常生活中發(fā)揮的作用也越來越大 , 為很多嵌入式控制系統(tǒng)提供了一種靈活性高且價(jià)廉的方案。在 FIASH 編程時(shí), P0 口作為原碼輸入口,當(dāng) FIASH 進(jìn)行校驗(yàn)時(shí), P0 輸出原碼,此時(shí) P0 外部必須被拉高。在 FLASH 編程和校驗(yàn)時(shí), P1 口作為第八位地址接收。 XTAL1:反向振蕩放大器的輸入及內(nèi)部時(shí)鐘工作電路的輸入。 EA/VPP:當(dāng) EA 保持低電平時(shí), 選用 外部程序存儲(chǔ)( 0000HFFFFH),當(dāng) EA端保持高 電平時(shí), 用 內(nèi)部程序存儲(chǔ)器。如圖 22 中所示,在引腳 XTAL1和 XTAL2 外接晶體振蕩器 (簡(jiǎn)稱晶振 ),就構(gòu)成了內(nèi)部振蕩方式。 2. 單片機(jī)復(fù)位電路: 當(dāng) MCS5l系列單片機(jī)的復(fù)位引腳 RST(全稱 RESET)出現(xiàn) 2 個(gè)機(jī)器周期以 上的高電平時(shí),單片機(jī)就執(zhí)行復(fù)位操作。當(dāng)單片機(jī)已在運(yùn)行當(dāng)中時(shí),按下復(fù)位鍵后松開,也能使 RST 保持 一段時(shí)間的高電平,從而實(shí)現(xiàn) 通電時(shí)的自動(dòng)復(fù)位操作,系統(tǒng)運(yùn)行過程中的 開關(guān)復(fù)位操作。 由于按鈕是機(jī)械觸點(diǎn),當(dāng)機(jī)械觸點(diǎn)斷開、閉合時(shí),會(huì)有抖動(dòng) , 這種抖動(dòng)對(duì)于人來說是感覺不到的,但對(duì)計(jì)算機(jī)來說,則是完全能感應(yīng)到的, 因?yàn)橛?jì)算機(jī)處理的速度是在微秒級(jí),而機(jī)械抖動(dòng)的時(shí)間至 少是毫秒級(jí) , 對(duì)計(jì)算機(jī)而言,這已是一個(gè) “ 漫長(zhǎng) ” 的時(shí)間了。 按鍵 與控制系統(tǒng) P0 口鍵連接,其連接如下表: 表 21 P0 口與控制鍵連接 控制鍵電路圖如 圖 23 所示: 圖 23 控制鍵電 路圖 167。ULN2020 是高耐壓、大電流、內(nèi)部由七個(gè)硅 NPN 達(dá)林頓管成的驅(qū)動(dòng)芯片。 步進(jìn)電機(jī)控制系統(tǒng)硬件電路圖 (見附錄 1) 畢業(yè)設(shè)計(jì)(論文) 14 第 3 章 步進(jìn)電機(jī)控制系統(tǒng)軟件設(shè)計(jì) 167。 降頻流程圖 圖 32 降頻流程圖 本文以 35BY48S03 步進(jìn)電機(jī)為例,首先根據(jù)步進(jìn)電機(jī)的特性設(shè)計(jì)一個(gè)數(shù)據(jù)區(qū),再編寫程序?qū)Υ藬?shù)據(jù)的的數(shù)據(jù)進(jìn)行調(diào)試。 走一步子程序流程圖 圖 33 走一步子程序流程圖 167。因此,需要對(duì)步進(jìn)電機(jī)采用 升降頻控制,以使電機(jī)從啟動(dòng)頻率 中 或者低于啟動(dòng)頻率的某個(gè)合適的值(此值與負(fù)載和步進(jìn)驅(qū)動(dòng)有關(guān))開始 啟動(dòng) ,逐漸加速升到運(yùn)行頻率然后進(jìn)入勻速運(yùn)行。 為了達(dá)到精確定位的目的, 在 編程時(shí),將頻率 F(n)的保持時(shí) 畢業(yè)設(shè)計(jì)(論文) 17 間換算為步數(shù),并對(duì)步數(shù) Z(n)進(jìn)行計(jì)數(shù)。 如圖 34 所示,我們?cè)O(shè)頻率最高升至 1000HZ,用時(shí)為 5S,依此確定縱坐標(biāo)每一小格所對(duì)應(yīng)的頻率,橫坐標(biāo)每一小格對(duì)應(yīng)的時(shí)間。 程序源代碼 系統(tǒng)詳細(xì)設(shè) 計(jì)程序如下: 文件: include include define uint unsigned int define uchar unsigned char //引腳定義 sbit Start=P0^0。 sbit AP=P1^0。 //定時(shí)器 T1 溢出延時(shí) void T1_Delay(uint temp)。 t=65536temp。0xff。 TR1=0。 AP=1。 T1_delay(t)。 BN=0。 BP=1。 AN=0。 AP=0。 Return。 BN=0。 SpeedUp=1。 AN=0。 F=100。 //升頻 if((!SpeedUp)amp。i++) { F=a[i]。j) MotRun(F)。 for(i=0。 for(j=bc。 MotRun(F)。而且隨著系統(tǒng)使用時(shí)間越來越長(zhǎng),元器件會(huì)發(fā)生變值。程序可用于調(diào)試步進(jìn)電機(jī)升降頻的數(shù)據(jù) 區(qū),在步進(jìn)電機(jī)的性能檢測(cè)、機(jī)械特性檢測(cè)上都有一定的用途,也可為數(shù)控系統(tǒng)提供一些數(shù)據(jù)。 3 : 3940 [5]伍云輝編著 .單片機(jī)應(yīng)用技術(shù) .電子科技大學(xué)出版社 ,1999 :5074 [6]陸子明,徐長(zhǎng)根編著 .單片機(jī)設(shè)計(jì)與應(yīng)用基礎(chǔ)教程 .國(guó)防工業(yè)出版社 ,1999:7988 [7]張蔚兮,王穎編著 .微型計(jì)算機(jī)( MCS51 系列)原理、接口及應(yīng)用 . 南京大學(xué)出版社 ,1999 : 2167 [8]張凱,馬忠梅等 .MCS51 單片機(jī)綜合系統(tǒng)及其設(shè)計(jì)開發(fā) .科學(xué)出版社 ,1996 : 352 [9]南建輝,王軍茹 .MCS51 單片機(jī)原理及應(yīng)用實(shí)例編著 .清華大學(xué)出版社 .,2020: 1569 [10]王季秩,曲家騏編著 .執(zhí)行電動(dòng)機(jī) .機(jī)械工業(yè)出版社 ,2020 : 2385 [11]李勛,李剛明 .單片微型計(jì)算機(jī)大學(xué)讀本 .北京航空航天大學(xué)出版社 ,1998 :7895 [12]吳微 ,文軍 .單片機(jī)原理及制作 .武漢大學(xué)出版社 ,1991 [13]蘇彥民編 .電力拖動(dòng)系統(tǒng)的微型計(jì)算機(jī)控制 .西安交通大學(xué)出版社 ,1988 :102205 [14]賴福新 .電機(jī)控制系統(tǒng) .上海交通大學(xué)出版社 ,1995 : 203254 [15]陳伯時(shí)主編 .電力拖動(dòng)自動(dòng)控制系統(tǒng)第二版 .機(jī)械工業(yè)出版社 ,1992 :5287 畢業(yè)設(shè)計(jì)(論文) 26 致 謝 經(jīng)過幾個(gè)月的忙碌和學(xué)習(xí),本次畢業(yè)論文設(shè)計(jì)已經(jīng)接近尾聲。除了敬高老師的專業(yè)水平外,她的治學(xué)嚴(yán)謹(jǐn)和科學(xué)研究的精神也是我永遠(yuǎn)學(xué)習(xí)的榜樣,并將積極影響我今后的學(xué)習(xí)和工作。 畢業(yè)設(shè)計(jì)(論文) 27 附 錄 1 硬件電路原理圖 畢業(yè)設(shè)計(jì)(論文) 28 附 錄 2 主流程圖 畢業(yè)設(shè)計(jì)(論文) 29 外 文 材 料 譯 文 Quick Start for Beginners to Drive a Stepper Motor Introduction This application note is for novices who want a general quickstart guide showing how to control a stepper motor. Because stepper motors can be used in a variety of ways and are driven by a variety of devices, there is a great deal of information available about how these motors work and how to use them. To reduce confusion, the focus of this application note is on stepper motors that can be driven by microcontrollers. This document includes basic information needed to get started quickly, and includes a practical example that is simple and easy to implement. What is a Stepper Motor? A stepper motor is an electrically powered motor that creates rotation from electrical current driven into the motor. Physically, stepper motors can be large but are often small enough to be driven by current on the order of milliampere. Current pulses are applied to the motor, and this generates discrete rotation of the motor shaft. This is unlike a DC motor that exhibits continuous rotation. Although it is possible to drive a stepper motor in a manner where it has near continuous rotation, doing so requires more finesse of the input waveform that drives the stepper motor. Figure 1 illustrates some basic differences in stepper and DC motor rotation. 畢業(yè)設(shè)計(jì)(論文) 30 Types of Stepper Motors There are a variety of stepper motors available, but most of them can be separated into two groups: ? Permanentmag (PM) stepper motor — This kind of motor creates rotation by using the forces between a permanent mag and an electromag created by electrical current. An interesting characteristic of this motor is that even when it is not powered, the motor exhibits some magic resistance to turning. ? Variablereluctance (VR) stepper motor — Unlike the PM stepper motor, the VR stepper motor does not have a permanentmag and creates rotation entirely with electromagic forces. This motor does not exhibit magic resistance to turning when the motor is not powered. What is Inside? 畢業(yè)設(shè)計(jì)(論文) 31 Generally, a stepper motor consists of a stator, a rotor with a shaft, and coil windings. The stator is a surrounding casing that remains stationary and is part of the motor housing, while the rotor is a central shaft within the motor that actually spins during use. The characteristics of these ponents and how they are arranged determines whether the stepper motor is a PM or VR stepper motor. Figure 2 and Figure 3 show an examp