⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guangfei.asm

📁 可用`Keil uVision2 软件编译
💻 ASM
📖 第 1 页 / 共 3 页
字号:
    	     call delayf
             cpl P0.4
             call delayf
             jb P2.2, jmp_guo5
             jnb P0.2,jmp_guo5
             jnb P2.3, jmp_ding_speaker5

	     cjne r3,#00h,panerr15
	     jmp hui15

panerr15:
             cjne r2,#01h,fu15_xiaodiji
	     cjne r3,#012h,fu15_xiaodiji
	     lcall  Kdelay
             jmp   kongjian_lo15
            ; jmp chong1
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    jmp_guo5:           jmp  ding_wj
    jmp_ding_speaker5:  jmp ding_speaker
        hui15:               jmp cuokong
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

kongjian_lo15:     ;  mov 40h,#1eh
kongjian_lo15_er:     cpl P0.4
                      mov r2,th0
                      mov r3,tl0
                     lcall delay_1
                   ; jb P3.4,kongstop01_lo11
                     jb P2.2, jmp_guo5
                     jnb P0.2,jmp_guo5
                     jnb P2.3, jmp_ding_speaker5
                     cjne r2,#01h,kongjian_lo15_er
	             cjne r3,#01bh,kongjian_lo15_er

   kongstop_lo15:    lcall Kdelay
                      mov 30h,#050h
     ;kongstop1_lo14: mov 31H,#029H
     kongstop2_lo15: cpl P0.5
                     lcall delay
                  ;   djnz 31H,kongstop2_lo14
                     djnz 30H,kongstop2_lo15

;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
chong5:         lcall Kdelay
                mov th0,#0h
                mov tl0,#0h
                clr tr0
                clr P2.1
		setb P0.6
                clr P2.0
                lcall Kdelay
                setb P2.1
		clr P0.6
                setb P0.5
                lcall  Kdelay
		lcall  Kdelay
               ; setb P2.0
               ; jb 21h.2, sensor_re_jmp2
              ;  setb  tr0
              ;  mov th0,#0h
             ;   mov tl0,#0h
                jmp fu15_smallfn
;sensor_re_jmp1:  jmp sensor_re
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;small-motor houzhuan
fu15_smallfn:
                 mov 30h,#0ceh
fu15_houzhuan:   mov 31h,#0ach
fu15_houzhuan1:  cpl P0.4
                 call delayf
                 cpl P0.4
                 call delayf
                 djnz 31h,fu15_houzhuan1
                 djnz 30h,fu15_houzhuan
                 lcall Kdelay
                 setb P3.2    ;qigang--go back
	         lcall Kdelay
	         lcall Kdelay

;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;small-motor run 周向定向
;;fu15_z_run:     cpl P0.4
               ;; call delays
	       ;; jb P3.1,fu15_runstop
	       ;; jmp fu15_z_run

;;fu15_runstop:    lcall Kdelay
            ;;    lcall Kdelay


;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;dig-motor to post
                mov th0,#0h
                mov tl0,#0h
                setb  tr0
                mov 30h,#0ceh
fu15_dadaji:    mov 31h,#012h
fu15_dadaji1:   cpl P0.5
                call delay
                djnz 31h,fu15_dadaji1
                djnz 30h,fu15_dadaji
                clr tr0
                lcall Kdelay
                jmp dingchang
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;mm/p=0.16671768186919       lengh=1650mm  p=9897
;不加减速后mm/p=0.1994374120956399   p=8213
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
LONG16:
fu16_waitwei:    jnb P2.4,fu16_weizhi
                 call delay
	         jmp fu16_waitwei
;^^^^^^^^^^^^^^^^^^^^^^^
;waiqigang----go out
fu16_weizhi:
                 call Kdelay
	         clr P3.2
		 setb tr0
	         call  Kdelay
;^^^^^^^^^^^^^^^^^^^^^^^^^
;slowp
fu16_btest:
fu16_btest1:      cpl P0.4
                  call delays
	          jb P3.0,fu16_slow_delay
	          jmp fu16_btest1
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
fu16_slow_delay:
                   mov 30h,#032h
fu16_slow_delay0:  mov 31h,#02fh
fu16_slow_delay1:  cpl P0.4
                   call delays
	           djnz 31h,fu16_slow_delay1
	           djnz 30h,fu16_slow_delay0
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;fast
fu16_xiaodiji:
             cpl P0.4
             mov r2,th0
             mov r3,tl0
    	     call delayf
             cpl P0.4
             call delayf
             jb P2.2, jmp_guo6     ;无菲林
             jnb P0.2,jmp_guo6     ;点动急停
             jnb P2.3, jmp_ding_speaker6    ;接头

	     cjne r3,#00h,panerr16
	     jmp hui16

panerr16:
             cjne r2,#01h,fu16_xiaodiji
	     cjne r3,#051h,fu16_xiaodiji
	     lcall  Kdelay
             jmp   kongjian_lo16
            ; jmp chong1
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    jmp_guo6:           jmp  ding_wj
    jmp_ding_speaker6:  jmp ding_speaker
        hui16:               jmp cuokong
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

kongjian_lo16:     ;  mov 40h,#1eh
kongjian_lo16_er:     cpl P0.4
                      mov r2,th0
                      mov r3,tl0
                     lcall delay_1
                   ; jb P3.4,kongstop01_lo11
                     jb P2.2, jmp_guo6
                     jnb P0.2,jmp_guo6
                     jnb P2.3, jmp_ding_speaker6
                     cjne r2,#01h,kongjian_lo16_er
	             cjne r3,#05ah,kongjian_lo16_er


   kongstop_lo16:    lcall Kdelay
                      mov 30h,#05ah
     kongstop2_lo16: cpl P0.5
                     lcall delay
                     djnz 30H,kongstop2_lo16
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
chong6:         mov th0,#0h
                mov tl0,#0h
                clr tr0
                clr P2.1
		setb P0.6
                clr P2.0
                lcall Kdelay
                setb P2.1
		clr P0.6
                setb P0.5
                lcall  Kdelay
		lcall  Kdelay
               ; setb P2.0
               ; jb 21h.2, sensor_re_jmp2
              ;  setb  tr0
              ;  mov th0,#0h
             ;   mov tl0,#0h
                jmp fu16_smallfn
;sensor_re_jmp1:  jmp sensor_re
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;small-motor houzhuan
fu16_smallfn:
                 mov 30h,#0ceh
fu16_houzhuan:   mov 31h,#0ach
fu16_houzhuan1:  cpl P0.4
                 call delayf
                 cpl P0.4
                 call delayf
                 djnz 31h,fu16_houzhuan1
                 djnz 30h,fu16_houzhuan
                 lcall Kdelay
                 setb P3.2    ;qigang--go back
	         lcall Kdelay
	         lcall Kdelay

;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;small-motor run 周向定向
;;fu16_z_run:     cpl P0.4
                ;;call delays
	        ;;jb P3.1,fu16_runstop
	        ;;jmp fu15_z_run

;;fu16_runstop:    lcall Kdelay
              ;;  lcall Kdelay


;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;dig-motor to post
                mov th0,#0h
                mov tl0,#0h
                setb  tr0
                mov 30h,#0ceh
fu16_dadaji:    mov 31h,#012h
fu16_dadaji1:   cpl P0.5
                call delay
                djnz 31h,fu16_dadaji1
                djnz 30h,fu16_dadaji
                clr tr0
                lcall Kdelay
                jmp dingchang
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++
;delay ret program
        delay:       mov r4, #26h
        delay10:     mov a,  #06h      ;6,8, a
       delay20:      dec a
                     jnz delay20
                     djnz r4,delay10
                     ret
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ;delay ret program
        delays:       mov r4, #26h
        delays10:     mov a,  #02h      ;6,8, a
       delays20:      dec a
                     jnz delays20
                     djnz r4,delays10
                     ret

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++

;delay ret program
        delayf:       mov r4, #01h
        delay10f:     mov a,  #01h      ;6,8, a  ;;;;
       delay20f:      dec a            ;;;
                     jnz delay20f
                     djnz r4,delay10f
                     ret
;######################################################
       Kdelay:    mov r5, #02h
       Kdelay1:   mov r4, #0FFh
       Kdelay11:  mov a,  #0FFh
       Kdelay21:  dec a
                  jnz Kdelay21
                  djnz r4,Kdelay11
                  djnz r5,Kdelay11
                  ret
 ;########################################
        SKdelay:   mov r5, #02h
       SKdelay1:   mov r4, #01eh
       SKdelay11:  mov a,  #0FFh
       SKdelay21:  dec a
                   jnz SKdelay21
                   djnz r4,SKdelay11
                   djnz r5,SKdelay11
                   ret

  LSKdelay:       mov r5, #0Fh
  LSKdelay1:      mov r4, #01eh
  LSKdelay11:     mov a,  #0FFh
  LSKdelay21:     dec a
                  jnz LSKdelay21
                  djnz r4,LSKdelay11
                  djnz r5,LSKdelay11
                  ret
 ;########################################
 ;########################################
;addspeet ret progrma
    intadd:      mov r7,#64h
      addsp:     mov 30h,#01h
                 mov 32h,r7
       asp1:     mov 31h, #0bh
        sp1:     lcall delay1
                 clr P0.5
                 lcall delay1
                 setb P0.5
                 djnz 31h,sp1
                 djnz 30h, asp1
                 dec r7
		 dec r7
		 cjne r7,#26h,addsp
		 ret



   intadd_p04:       mov r7,#04ch
      addsp_p04:     mov 30h,#05h
                     mov 32h,r7
       asp1_p04:     mov 31h, #014h
        sp1_p04:     cpl P0.4
                     lcall delay1f
                     djnz 31h,sp1_p04
                     djnz 30h, asp1_p04
                     dec r7
		     dec r7
	             cjne r7,#02h,addsp_p04
	             ret



;dec speet ret program
    intdec:      mov r7,#016h
   deaddsp:      mov 30h,#012h
                 mov 32h,r7
    deasp1:      mov 31h, #0feh
     desp1:      lcall delay1
                 clr P0.5
                 lcall delay1
                 setb P0.5
                 djnz 31h,desp1
                 djnz 30h, deasp1
                 inc r7
		 inc r7
		 cjne r7,#64h,deaddsp
		 ret
;#######################################################
    reintdec:    mov r7,#0ah
   jiansp:       mov 30h,#02h
                 mov 32h,r7
    jiansp1:     mov 31h, #21h
     jiansp01:   lcall delay1
                 clr P0.5
                 lcall delay1
                 setb P0.5
                 djnz 31h,jiansp01
                 djnz 30h,jiansp1
                 inc r7
	;	 inc r7
		 cjne r7,#26h,jiansp
		 ret
;#######################################################
    seadd:       mov r7,#26h
   jiasp:        mov 30h,#01h
                 mov 32h,r7
   jiasp1:       mov 31h, #01bh
     jiasp01:    lcall delay1
                 clr P0.5
                 lcall delay1
                 setb P0.5
                 djnz 31h,jiasp01
                 djnz 30h,  jiasp1
                 dec r7
	;	 dec r7
		 cjne r7,#0ah,jiasp
		 ret
;#######################################################
      CLEAR:
                mov 20h,#00h
	        setb P0.0
                setb P0.1
                setb P0.2
                setb P0.3
                setb P0.7

                clr P1.6     ;喇叭
                clr 21h.2

                setb P1.1
                setb P1.2
                setb P1.3
                setb P1.4
                setb P1.5
              ;  setb  P2.6
                setb  P2.5
                setb P1.7
		setb P3.4


                 setb P2.1
                ; setb P2.5
                 setb P2.2

                 setb  P2.0

                 SETB P2.4
                 setb P2.3
		 CLR P0.6

                setb P0.5
                setb P2.4
                mov 30h,#00h    ;变速阶梯数
                mov 31h,#00h    ;变速步长
        	mov 32h,#00h    ;delay1 入
		ret
;#######################################################
;delay ret program

        L1_delay:   mov r4, #016h
        L1_delay10: mov a,  #07h      ;6,8, a
       L1_delay20:  dec a
                   jnz L1_delay20
                   djnz r4,L1_delay10
                   ret
 ;#######################################################
;delay ret program

        L2_delay:   mov r4, #016h
        L2_delay10: mov a,  #0ah      ;6,8, a
       L2_delay20:  dec a
                    jnz L2_delay20
                    djnz r4,L2_delay10
                    ret
;#######################################################
        delay_1:       mov r4, #07h
        delay10_1:     mov a,  #02h      ;6,8, a
       delay20_1:      dec a
                       jnz delay20_1
                       djnz r4,delay10_1
                       ret
;######################################################
        delay_f:   mov r4, #010h
        delay10_f: mov a,  #05h   ;4,6,7
       delay20_f:  dec a
                   jnz delay20_f
                   djnz r4,delay10_f
                   ret
;add-speet delay  ret program
       delay1:     mov r4, 32h
       delay11:    mov a,  #06h
       delay21:    dec a
                   jnz delay21
                   djnz r4,delay11
                   ret


;add-speet delay  ret program
       delay1f:     mov r4, 32h
       delay11f:    mov a,  #01h
       delay21f:    dec a
                    jnz delay21f
                    djnz r4,delay11f
                    ret
   ;########################################

       KKdelay:    mov r5, #01h
       KKdelay1:   mov r4, #064h
       KKdelay11:  mov a,  #064h
       KKdelay21:  dec a
                   jnz KKdelay21
                   djnz r4,KKdelay11
                   djnz r5,KKdelay11
                   ret
;##########################################
;************
;  延时程序 *
;************
DL512: MOV      R2,#0FFH
LOOP1: DJNZ     R2,LOOP1
       RET
;*************
DL10MS:MOV      R3,#0c8H
LOOP2: LCALL    DL512
       DJNZ     R3,LOOP2
       RET
;***************************************************************************************
       end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -