ImageVerifierCode 换一换
格式:DOCX , 页数:31 ,大小:17.83KB ,
资源ID:8670631      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8670631.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(寻迹小车.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

寻迹小车.docx

1、寻迹小车realh equ 30h reall equ 31h wanth equ 32h wantl equ 33h bufferh equ 34h bufferl equ 35h bit_count equ 36h timer equ 37h timer1 equ 38dh data_in equ 020h data_out equ 021h s0 equ 022h num equ 3ch buffer equ 3dh s equ 3eh spre equ 3fh spre1 equ 40h cs bit p3.5 clk bit p3.4 dat bit p3.3 upret bit p

2、2.0 upkep bit p2.1 hangret bit p2.2 hangkep bit p2.3 hangled bit p2.4 lieled bit p2.5 led1 bit p1.0 led2 bit p1.1 led3 bit p1.2 led4 bit p1.3 org 0000 jmp main org 0003h jmp input org 0bh ljmp timer0 org 0030h table1: db 1 db 2 db 3 db 4 org 38h db 5 db 6 db 7 db 8 org 40h db 9 db 0 db 10 db 11 org

3、48h db 12 db 13 db 14 db 15 table2: db 0 db 25 db 1 db 25 db 2 db 25 db 3 db 25 db 4 db 25 db 5 db 24 db 6 db 24 db 7 db 24 db 8 db 24 db 9 db 23 db 10 db 23 db 11 db 22 db 12 db 22 db 13 db 21 db 14 db 21 db 15 db 20 db 16 db 20 db 17 db 18 db 18 db 17 db 20 db 16 db 20 db 15 db 21 db 14 db 21 db 1

4、3 db 22 db 12 db 22 db 11 db 23 db 10 db 23 db 9 db 24 db 8 db 24 db 7 db 24 db 6 db 24 db 5 db 25 db 4 db 25 db 3 db 25 db 2 db 25 db 1 db 25 db 0 db 25 db -1 db 25 db -2 db 25 db -3 db 25 db -4 db 24 db -5 db 24 db -6 db 24 db -7 db 24 db -8 db 23 db -9 db 23 db -10 db 22 db -11 db 22 db -12 db 21

5、 db -13 db 21 db -14 db 20 db -15 db 20 db -16 db 18 db -17 db 17 db -18 db 16 db -20 db 15 db -20 db 14 db -21 db 13 db -21 db 12 db -22 db 11 db -22 db 10 db -23 db 9 db -23 db 8 db -24 db 7 db -24 db 6 db -24 db 5 db -24 db 4 db -25 db 3 db -25 db 2 db -25 db 1 db -25 db 0 db -25 db -1 db -25 db

6、-2 db -25 db -3 db -25 db -4 db -25 db -5 db -24 db -6 db -24 db -7 db -24 db -8 db -24 db -9 db -23 db -10 db -23 db -11 db -22 db -12 db -22 db -13 db -21 db -14 db -21 db -15 db -20 db -16 db -20 db -17 db -18 db -18 db -17 db -20 db -16 db -20 db -15 db -21 db -14 db -21 db -13 db -22 db -12 db

7、-22 db -11 db -23 db -10 db -23 db -9 db -24 db -8 db -24 db -7 db -24 db -6 db -24 db -5 db -25 db -4 db -25 db -3 db -25 db -2 db -25 db -1 db -25 db -0 db -25 db 1 db -25 db 2 db -25 db 3 db -25 db 4 db -24 db 5 db -24 db 6 db -24 db 7 db -24 db 8 db -23 db 9 db -23 db 10 db -22 db 11 db -22 db 1

8、2 db -21 db 13 db -21 db 14 db -20 db 15 db -20 db 16 db -18 db 17 db -17 db 18 db -16 db 20 db -15 db 20 db -14 db 21 db -13 db 21 db -12 db 22 db -11 db 22 db -10 db 23 db -9 db 23 db -8 db 24 db -7 db 24 db -6 db 24 db -5 db 24 db -4 db 25 db -3 db 25 db -2 db 25 db -1 db 25 db 0 db 25 org 400h m

9、ain: clr upkep ;端口初始化 clr hangkep mov num,#0 ;变量初始化 mov sp,#4fh mov timer,#50 ;7279初始化 start_delay: mov timer1,#255 start_delay1: djnz timer1,start_delay1 djnz timer,start_delay mov data_out,#10100100b call send ;mov data_out,#0bfh ;call send setb cs setb upret setb upkep setb hangret setb hangkep ;

10、坐标初始化 acall delay herec:jnb hangled,herec clr hangkep clr upkep mov reall,#00 clr upret setb upkep acall delay hered:jnb lieled,hered clr upkep mov realh,#0 acall write mov tcon,#01h ;中断初始化 mov ie,#81h hered1: sjmp hered1 input: push acc push b acall read mov a,data_in cjne a,#10,next10 mov num,#0 a

11、call move ;直走 jmp exitin next10: cjne a,#11,next11 mov num,#0 mov dptr,#table2 mov r0,#141 ;? nextcir: movx a,dptr add a,wanth mov wanth,a inc dptr movx a,dptr add a,wantl mov wantl,a inc dptr acall move djnz r0,nextcir ;划圆 jmp exitin next11: cjne a,#12,next12 acall xunji ;寻迹 jmp exitin next12: cjne

12、 A,#13,NEXT13 mov num,#0 ;发挥 jmp exitin next13: ;输入数据 mov r0,num cjne r0,#0,nexth1 mov buffer,data_in mov data_out,data_in mov data_out,#86h call send mov data_out,data_in call send setb cs jmp outin nexth1: cjne r0,#1,nexth2 mov b,#10 mov a,buffer mul ab clr c add a,data_in mov buffer,a mov data_ou

13、t,data_in mov data_out,#85h call send mov data_out,data_in call send setb cs jmp outin nexth2: cjne r0,#2,nexth3 mov b,#10 mov a,buffer mul ab add a,data_in mov data_out,data_in mov data_out,#84h call send mov data_out,data_in call send setb cs mov wantl,a jmp outin nexth3: cjne r0,#3,nextl1 mov buf

14、fer,data_in mov data_out,data_in mov data_out,#82h call send mov data_out,data_in call send setb cs jmp outin nextl1: cjne r0,#4,nextl2 mov b,#10 mov a,buffer mul ab clr c add a,data_in mov buffer,a mov data_out,data_in mov data_out,#81h call send mov data_out,data_in call send setb cs jmp outin nex

15、tl2: cjne r0,#5,nextl3 mov b,#10 mov a,buffer mul ab clr c add a,data_in mov data_out,data_in mov data_out,#80h call send mov data_out,data_in call send setb cs mov wanth,a jmp outin nextL3: mov num,#0 mov data_out,#10100100b call send SETB CS jmp NEXT13 outin: inc num exitin: pop b pop acc reti mov

16、e: ;运动程序 PUSH ACC begin1: MOV A,reall CJNE A,wantl,NEXTM1 clr hangkep clr upkep ;停止运动 JMP begin2 ;转到行调整 NEXTM1: CLR C SUBB A,wantl JC NEXTMX clr hangret clr upret ;向左 SETB hangkep setb upkep ;开始运动 ACALL DELAY HEREM1:jnb hangled,herem1 dec reall acall write sjmp begin1 nextmx: setb hangret setb upret

17、 ;向右 setb hangkep setb upkep ;开始运动 acall delay herem2:jnb hangled,herem2 inc reall acall write jmp begin1 begin2: mov a,realh CJNE A,wanth,nextm3 clr upkep JMP outmov NEXTM3: CLR C SUBB A,wanth JC NEXTMX2 SETB upret ;向下 SETB upkep ;开始运动 ACALL DELAY HEREM3:jnb lieled,herem3 dec realh acall write jmp

18、begin2 nextmx2: clr upret ;向上 setb upkep ;开始运动 acall delay herem4:jnb lieled,herem4 inc realh acall write jmp begin2 outmov: pop acc ret write: ;显示运动中实际位置 push acc push b mov a,realh mov b,#10 div ab mov data_out,#84h call send mov data_out,b call send mov b,#10 div ab mov data_out,#85h call send mo

19、v data_out,b call send mov data_out,#86h call send mov data_out,A call send mov a,reall mov b,#10 div ab mov data_out,#80h call send mov data_out,b call send mov b,#10 div ab mov data_out,#81h call send mov data_out,b call send mov data_out,#82h call send mov data_out,A call send pop b pop acc ret s

20、end: ;7279显示 PUSH ACC mov bit_count,#8 clr cs call long_delay send_loop: mov c,data_out.7 mov dat,c setb clk mov a,data_out rl a mov data_out,a call short_delay clr clk djnz bit_count,send_loop clr dat POP ACC ret read: ;读键盘 push acc push psw push dpl push dph mov data_out,#00010101b call send mov b

21、it_count,#8 setb dat call long_delay receive_loop: setb clk call short_delay mov a,data_in rl a mov data_in,a mov c,dat mov data_in.0,c clr clk call short_delay djnz bit_count,receive_loop clr dat mov a,data_in mov dptr,#table1 movc a,a+dptr mov data_in,a setb cs pop dph pop dpl pop psw pop acc ret

22、delay: ;光电扫描延时 mov r2,#2; timeD: mov r1,#255; loop2: mov r0,#255; loop1: djnz r0,loop1; djnz r1,loop2; djnz r2,timeD; ret long_delay: ;7279长延时 mov timer,#25 delay_loop:djnz timer,delay_loop ret short_delay: ;7279短延时 mov timer,#4 short_lp: djnz timer,short_lp ret timer0: mov spre1,s clr tr0 reti xunj

23、i: mov num,#0 mov s,#00 mov spre,#02h mov spre1,#02h lcall fuzhi nextxun: mov a,p1 anl a,#0fh cjne a,#0h ,nextxun0 sjmp nextxun nextxun0: cjne a,#01h,nextx1 mov r0,s cjne r0,#00h,nextx11 mov r0,spre1 cjne r0,#02,nextx111 jmp search nextx111: mov s,#03h lcall fuzhi mov spre,#00 mov spre1,spre mov tl0

24、,#0 mov th0,#03 setb tr0 nextx11: mov r0,spre1 cjne r0,#00,nextx112 jmp search nextx112: mov s,#01h lcall fuzhi mov spre ,#02 mov spre1,spre mov tl0,#0 mov th0,#3 setb tr0 jmp nextxun nextx1: cjne a,#02h,nextx2 mov r0,s cjne r0,#00h,nextx21 mov r0,spre1 cjne r0,#03,nextx211 jmp search nextx211: mov

25、s,#02h lcall fuzhi mov spre,#00 mov spre1,spre mov tl0,#0 mov th0,#3 setb tr0 nextx21: mov r0,spre1 cjne r0,#00,nextx212 jmp search nextx212: mov s,#01h lcall fuzhi mov spre ,#03 mov spre1,spre mov tl0,#0 mov th0,#3 setb tr0 jmp nextxun nextx2: cjne a,#04h,nextx3 mov r0,s cjne r0,#01h,nextx31 mov r0

26、,spre1 cjne r0,#02,nextx311 jmp search nextx311: mov s,#03h lcall fuzhi mov spre,#01 mov spre1,spre mov tl0,#0 mov th0,#3 setb tr0 nextx31: mov r0,spre1 cjne r0,#01,nextx312 jmp search nextx312: mov s,#00h lcall fuzhi mov spre ,#02 mov spre1,spre mov tl0,#0 mov th0,#3 setb tr0 jmp nextxun nextx3: cjne a,#08h,search mov r0,s cjne r0,#01h,nextx41 mov r0,spre1 cjne r0,#03,nextx411 jm

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1