版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、考試序列號(hào) 18課 程 設(shè) 計(jì)論文題目:步進(jìn)電機(jī)角度控制(2)課程名稱:計(jì)算機(jī)控制技術(shù)學(xué)院自動(dòng)化學(xué)院專業(yè)班級(jí)學(xué)號(hào)8姓名指導(dǎo)教師2013 年 06 月 25 日一、 目的:1. 鞏固和加深對(duì)計(jì)算機(jī)控制技術(shù)課程內(nèi)容的認(rèn)識(shí)和理解,提高應(yīng)用水平。2. 熟悉鍵盤控制和七段數(shù)碼管的使用。3. 掌握直流電機(jī)的速度控制和測(cè)試方法。二、 課程設(shè)計(jì)內(nèi)容1. 在顯示器上顯示任意四位十進(jìn)制數(shù)。2. 將8個(gè)鍵定義鍵值為07,按任意鍵在顯示器上顯示對(duì)應(yīng)鍵值。3. 實(shí)現(xiàn):(1) 定義鍵盤按鍵:5個(gè)數(shù)字鍵;3個(gè)功能鍵:設(shè)置SET、清零CLR、開(kāi)始START;(2) 顯示器上第一位顯示次數(shù),后三位顯示每次行走的角度;(3) 通
2、過(guò)鍵盤的按鍵,設(shè)置步進(jìn)電機(jī)各次的角度值;按動(dòng)SET鍵后,開(kāi)始設(shè)置:第一位設(shè)置次數(shù),后三位設(shè)置角度值,再按動(dòng)SET置入;可連續(xù)置入的角度。(4) 按START鍵啟動(dòng)步進(jìn)電機(jī)開(kāi)始轉(zhuǎn)動(dòng),到位后停止;按CLR鍵清零步進(jìn)電機(jī)回原位。4. 電路框圖(參見(jiàn)任務(wù)書)。三、 任務(wù)要求1. 設(shè)置鍵盤為下圖所示:2457CLRSETSTART02. 要求實(shí)現(xiàn)以下功能:(1) 鍵入4(次數(shù))270(角度值)鍵入SET設(shè)置完畢,鍵入START步進(jìn)電機(jī)轉(zhuǎn)動(dòng)270度4次;停止后鍵入CLR返回零位;每個(gè)過(guò)程都必須有相關(guān)的顯示。(2) 鍵入7(次數(shù))45(角度值)鍵入SET設(shè)置完畢,鍵入START步進(jìn)電機(jī)轉(zhuǎn)動(dòng)45度7次;停止后
3、鍵入CLR返回零位;每個(gè)過(guò)程都必須有相關(guān)的顯示。四、 程序代碼實(shí)驗(yàn)一:按鍵設(shè)置為0178 EFAB程序:ORG0000HLJMP MAINORG0100HMAIN:MOV50H,#00HMOV51H,#00HMOV52H,#00HMOV53H,#00HMOVR5,#53H;-BEGIN:MOVDPTR,#7F03HMOVA,#81HMOVXDPTR,A;-MOVDPTR,#7F00HMOVA,#00HMOVXDPTR,AMOVDPTR,#7F02HMOVA,DPTRANLA,#03HCJNEA,#03H,INK1ACALLDISAJMPBEGININK1:ACALLDL1MSMOVDPTR,#
4、7F02HMOVXA,DPTRANLA,#03HCJNEA,#03H,INK2INK2:MOVDPTR,#7F00HMOVA,#0FEHMOVXDPTR,AMOVDPTR,#7F02HMOVXA,DPTRJNBACC.1,KEY0JNBACC.0,KEYDAJMPBEGIN;-MOVDPTR,#7F00HMOVA,#0FDHMOVXDPTR,AMOVDPTR,#7F02HMOVA,DPTRJNBACC.1,KEY1JNBACC.0,KEYFMOVDPTR,#7F00HMOVA,#0FBHMOVXDPTR,AMOVDPTR,#7F02HMOVA,DPTRJNBACC.1,KEY7JNBACC.0
5、,KEYAMOVDPTR,#7F00HMOVA,#0FBHMOVXDPTR,AMOVDPTR,#7F02HMOVXA,DPTRJNBACC.1,KEY8JNBACC.0,KEYB;-KEY0:MOVDPTR,#7F00HMOVA,#00HMOVXDPTR,AACALLPUTBUFACALLDISAJMPSTTKKEY1:MOVDPTR,#7F01HMOVA,#00HMOVXDPTR,AACALLPUTBUFACALLDISAJMPSTTKKEY7:MOVDPTR,#7F07HMOVA,#00HMOVXDPTR,AACALLPUTBUFACALLDISAJMPSTTKKEY8:MOVDPTR,#
6、7F08HMOVA,#00HMOVXDPTR,AACALLPUTBUFACALLDISAJMPSTTKKEYA:MOVDPTR,#7F0AHMOVA,#00HMOVXDPTR,AACALLPUTBUFACALLDISAJMPSTTKKEYB:MOVDPTR,#7F0BHMOVA,#00HMOVXDPTR,AACALLPUTBUFACALLDISAJMPSTTKKEYE:MOVDPTR,#7F0EHMOVA,#00HMOVXDPTR,AACALLPUTBUFACALLDISAJMPSTTKKEYF:MOVDPTR,#7F0FHMOVA,#00HMOVXDPTR,AACALLPUTBUFACALL
7、DISAJMPSTTK;-PUTBUF:PUSH00HPUSHACCMOVA,R5MOVR0,APOPACCMOVR0,ADECR5CJNER5,#4FH,GOBACKMOVR5,#53HGOBACK:POP00HRETDIS:PUSHACCPUSH00HPUSH03HPUSHDPHPUSHDPLMOVR0,#50HMOVR3,#F7HAA2:MOVA,R0MOVDPTR,#AA1MOVCA,A+DPTRMOVDPTR,#7F01HMOVXDPTR,AMOVDPTR,#7F02HMOVXDPTR,R3ACALLDL1MSMOVA,R3JNBACC.0,AA3RRAMOVR3,AINCR0AJM
8、PAA2AA3:POPDPLPOPDPHPOP03HPOP00HPOPACCRETAA1:DB3FH,06H,5BH,4FH,66H,6DH,7DH,07HDB7FH,6FH,77H,7CH,39H,5EH,79H,71H;-DL1MS:MOVR7,#01HDL0:MOVR6,#0FFHDL1:DJNZR6,DL1DJNZR7,DL0RET;-STTK:ACALLDISMOVDPTR,#7F00HMOVA,#00HMOVXDPTR,AMOVDPTR,#7F02HMOVA,DPTRANLA,#03HCJNEA,#03H,STTKAJMPBEGINEND;-實(shí)驗(yàn)二:程序:ORG0000HLJMPM
9、AINORG0100HMAIN:MOV50H,#00H ;角度個(gè)位MOV51H,#00H ;角度十位MOV52H,#00H ;角度百位MOV53H,#00H ;轉(zhuǎn)次數(shù)MOV54H,#00H ;START標(biāo)志位MOV55H,#00H ;CLR標(biāo)志位MOV56H,#00H MOV57H,#00H ;正反轉(zhuǎn)標(biāo)志位MOV58H,#01H;前后4拍標(biāo)志位MOV59H,#00H;存放轉(zhuǎn)的步數(shù)MOV 60H,#00H ;角度個(gè)位MOV 61H,#00H ;角度十位MOV 62H,#00H ;角度百位MOV 63H,#00H;轉(zhuǎn)次數(shù)MOV DPTR,#7F03H MOV A,#81H MOVX DPTR,AB
10、EGIN: MOV DPTR,#7F00H ;鍵盤檢測(cè)MOV A,#00HMOVX DPTR,A MOV DPTR,#7F02HMOVX A,DPTRANL A,#03HCJNE A,#03H,INK1MOV A,54H ;電機(jī)運(yùn)動(dòng)及正反轉(zhuǎn)判斷 CJNE A,#01H,TEST1 ;START=0跳 MOV A,55H CJNE A,#01H ,ZHENG ;CLR=0跳 AJMP NT ;跳去顯示TEST1: MOV A,55H ;START=0CJNE A,#01H,NT ;START=0,CLR=0跳去顯示FAN: MOV 57H,#00H ;給個(gè)反轉(zhuǎn)標(biāo)志 LCALL BJF AJMP
11、BEGINZHENG: MOV 57H,#01H;給個(gè)正傳標(biāo)志 ACALL BJZNT: ACALL DISAJMP BEGININK1: ACALL DL1MSMOV DPTR,#7F02HMOVX A,DPTRANL A,#03HCJNE A,#03H,INK2AJMP BEGININK2: MOV DPTR,#7F00HMOV A,#0FEHMOVX DPTR,AMOV DPTR,#7F02HMOVX A,DPTRJNB ACC.1,KEY2JNB ACC.0,KEYCLRMOV DPTR,#7F00HMOV A,#0FDHMOVX DPTR,A MOV DPTR,#7F02HMOVX
12、A,DPTRJNB ACC.1,KEY4JNB ACC.0,KEYSETMOV DPTR,#7F00HMOV A,#0FBHMOVX DPTR,AMOV DPTR,#7F02HMOVX A,DPTRJNB ACC.1,KEY5JNB ACC.0,KEYSTARTMOV DPTR,#7F00HMOV A,#0F7HMOVX DPTR,AMOV DPTR,#7F02HMOVX A,DPTRJNB ACC.1,KEY7JNB ACC.0,KEY0LJMP STTKKEYCLR:MOV 54H,#00H LJMP STTKKEYSTART:MOV 54H,#01H LJMP STTKKEYSET:MO
13、V 60H,50HMOV 61H,51HMOV 62H,52HMOV 63H,53HMOV 50H,#00HMOV 51H,#00HMOV 52H,#00HMOV 53H,#00H LJMP STTKKEY0: MOVA,#00HACALL PUTBUFACALL DISLJMP STTKKEY2: MOV A,#02HACALL PUTBUFACALL DISLJMP STTKKEY4: MOV A,#04HACALL PUTBUFACALL DISLJMP STTKKEY5: MOV A,#05HACALL PUTBUFACALL DISLJMP STTKKEY7: MOV A,#07HA
14、CALL PUTBUFACALL DISLJMP STTKPUTBUF: PUSH 00HPUSH ACCMOVR1,#3MOV R0,#52HPUTBUF0:MOV A,R0INCR0MOV R0,ADECR0DEC R0DJNZ R1,PUTBUF0POPACCMOV 50H,APOP 00H RETDIS: PUSH ACCPUSH 00H PUSH 03HMOV R0,#50HMOV R3,#0F7HAA2:MOV A,R0MOV DPTR,#A1MOVC A,A+DPTRMOV DPTR,#7F01HMOVX DPTR,AMOV DPTR,#7F00HMOVA,R3MOVX DPTR
15、,AACALL DL1MSMOV A,R3JNB ACC.0,AA3RR AMOV R3,AINC R0AJMP AA2AA3:POP 03HPOP 00HPOPACCRETSTTK:ACALL DIS MOV DPTR,#7F00HMOV A,#00HMOVX DPTR,A MOV DPTR,#7F02HMOVX A,DPTRANL A,#03HCJNE A,#03H,STTKAJMP BEGINA1:DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H DB 7FH,6FH,77H,7CH,39H,5EH,79H,71HDL1MS:MOV R7,#02HDL0: MOV R
16、6,#0FFHDL1: DJNZ R6,DL1DJNZ R7,DL0RETBJZ: MOV 57H,#01H;正轉(zhuǎn)標(biāo)志ACALL BJ1MOV 40H,50HMOV 41H,51HMOV 42H,52HMOV 43H,53H MOV 50H,60HMOV 51H,61HMOV 52H,62HMOV 53H,63HMOV 57H,#01H;正轉(zhuǎn)標(biāo)志ACALL BJ1 MOV 54H,#01HMOV 55H,#01H RETBJF: MOV 57H,#00H;反轉(zhuǎn)標(biāo)志ACALL BJ1 MOV 60H,#00HMOV 61H,#00HMOV 62H,#00HMOV 63H,#00HMOV 50H,
17、40HMOV 51H,41HMOV 52H,42HMOV 53H,43HMOV 57H,#00H;反轉(zhuǎn)標(biāo)志 ACALL BJ1MOV 50H,#00H MOV 51H,#00H MOV 52H,#00H MOV 53H,#00H MOV 54H,#00HMOV 55H,#00H RET BJ1: PUSH 03H;轉(zhuǎn)動(dòng)角數(shù)據(jù)處理 MOV R0,#52H;百位 MOV A,R0 MOV B,#6H;100=15*6+10 CLR C MULAB MOV R1,A;n次15的一個(gè)分量 MOV R0,#51H;十位 MOV A,R0 ADD A,52H MOV B,#0AH CLRC MUL AB
18、MOV R0,#50H;個(gè)位 ADD A,R0;將個(gè)位和十位和陳一個(gè)數(shù) MOV B,#0FH CLR C DIV AB ADD A,R1;要轉(zhuǎn)A次15MOV 59H,AMOV R0,53H MOV 56H,53HMOV A,R0 CJNEA,#00H,AAA4MOV 54H,#00HMOV 55H,#00HAJMP BACKAAA4: MOV R5,53HAAA3:MOV R1,59H;轉(zhuǎn)R1次*15AAA2:MOVR0,#04H ;步距4拍MOVA,57HCJNE A,#01H,FZMOV A,58HCJNE A,#01H,ZX;看標(biāo)志位是走前4拍還是后4拍58=1,走ZSMOV DPTR,#L1;前4拍CPL AMOV 58H,A;標(biāo)志位區(qū)反AJMP AAA1ZX: MOV DPTR,#L2;后4拍CPL AMOV 58H,AAJMP AAA1FZ: MOV A,58HCJNE A,#01H,FX ;看標(biāo)志位是走前4拍還是后4拍58=1,走ZSMOV D
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030年中國(guó)黃金鉑金等金首飾行業(yè)營(yíng)銷創(chuàng)新戰(zhàn)略制定與實(shí)施研究報(bào)告
- 建設(shè)生態(tài)科普旅游強(qiáng)縣思路調(diào)研報(bào)告-范文
- 有關(guān)普洱茶餅的問(wèn)卷調(diào)查
- 建設(shè)工程租賃合同文本(同名3639)
- 2024年一年級(jí)語(yǔ)文上冊(cè)《雨點(diǎn)兒》教案(10篇)
- 2019-2025年云南省酒店市場(chǎng)評(píng)估分析及發(fā)展前景調(diào)查戰(zhàn)略研究報(bào)告
- 某鎮(zhèn)派出所建設(shè)項(xiàng)目可行性研究報(bào)告
- 2025年中國(guó)體育營(yíng)銷行業(yè)市場(chǎng)調(diào)研分析及投資戰(zhàn)略咨詢報(bào)告
- 浙江省臺(tái)州市三門縣2023-2024學(xué)年五年級(jí)上學(xué)期英語(yǔ)期末試卷
- 電商專利知識(shí)培訓(xùn)課件
- 春節(jié)英語(yǔ)介紹SpringFestival(課件)新思維小學(xué)英語(yǔ)5A
- 卵巢囊腫蒂扭轉(zhuǎn)的臨床分析
- 退休職工安全知識(shí)講座
- 全國(guó)兒童預(yù)防接種知識(shí)講座
- GMP理念在制藥工程項(xiàng)目中的應(yīng)用
- 電信營(yíng)業(yè)廳規(guī)章制度范文
- 提高感染性休克集束化治療完成率工作方案
- 突發(fā)事件緊急醫(yī)學(xué)救援中的煙花爆竹傷處理培訓(xùn)
- 產(chǎn)品質(zhì)量監(jiān)控方案
- 《白夜行》名著導(dǎo)讀讀書分享
- 區(qū)域分析與規(guī)劃課件
評(píng)論
0/150
提交評(píng)論