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

📄 jishu.asm

📁 这是一个铁板冲床计数器的ASM原代码。用来进行铁板冲压的计件。本源码控制变频器2394次中断三秒继续计数。
💻 ASM
字号:
     stcp   equ    p1.4          ;lee
     shcp   equ    p1.5          ;clk
     din    equ    p1.2          ;din
     pl1    equ    p1.0
     pl2    equ    p1.1
     dh     equ    60h
     dl     equ    61h
     dhh     equ   66h
     dll     equ   67h
     dm4    equ    65h
     dm3    equ    64h
     dm2    equ    63h
     dm1    equ    62h
     org    0000h
     sjmp   star
     org    0003h
     jmp   read
star:
     mov sp,#30h
     clr stcp
     clr shcp
     mov r1,#32
liu:
     mov dhh,#0
     mov dll,#0
look:
     mov a,dhh
     mov dh,a
     mov a,dll
     mov dl,a
     call btod
     call display
     setb ea
     setb ex0
     setb tr0
     sjmp $
read:
     jb p3.2,gent
     call delay
     jb p3.2,gent
     jnb p3.2,$

     clr ex0
     mov a,dll
     add a,#1
     mov dll,a
     mov a,dhh
     addc a,#0
     mov dhh,a
     cjne a,#9h,golook
     mov  a,dll
     cjne a,#5bh,golook
     mov dll,#0
     mov dhh,#0
     clr pl1
     clr pl2
     call delay3s
     setb pl1
     setb pl2
golook:
     mov a,dhh
     mov dh,a
     mov a,dll
     mov dl,a
     call btod
     call display
     setb ex0
gent:
     reti
btod:;(将十六进制转换成十进制)(r4,r3)
     clr a
     mov dm4,a
     mov dm3,a
     mov dm2,a
     mov dm1,a
btod1:
     mov a,dl
     mov r3,a
     clr c
     subb a,#0e8h
     mov dl,a
     mov a,dh
     mov r4,a
     subb a,#3
     mov dh,a
     jc btod2
     inc dm4
     sjmp btod1
btod2:
     mov a,r3
     mov dl,a
     mov a,r4
     mov dh,a
btod3:
     mov a,dl
     mov r3,a
     clr c
     subb a,#64h
     mov dl,a
     mov a,dh
     mov r4,a
     subb a,#0
     mov dh,a
     jc btod4
     inc dm3
     sjmp btod3
btod4:
     mov a,r3
     mov b,#10
     div ab
     mov dm2,a
     mov dm1,b
     ret
display:;(将结果显示出来)
    mov a,dm4
    call readx_d
    call txxd

    mov a,dm3
    call readx_d
    call txxd

    mov a,dm2
    call readx_d
    call txxd

    mov a,dm1
    call readx_d
    call txxd
    setb stcp
    clr  stcp
    ret
readx_d:
     mov dptr,#date
     movc a,@a+dptr
    ; cpl a
     ret
delay:
    mov r5,#1
del1:
    mov r6,#5
dela1:
    mov r7,#10
    djnz r7,$
    djnz r6,dela1
    djnz r5,del1
    ret
delay3s:
    mov r5,#21
del13:
    mov r6,#0ffh
dela13:
    mov r7,#0ffh
    djnz r7,$
    djnz r6,dela13
    djnz r5,del13
    ret

txxd:
    mov r1,#8
txd1:
    rlc a
    mov din,c
    clr shcp
    setb shcp
    djnz r1,txd1
    ret


date:
     db 0fch,60h,0dah,0f2h,66h,0b6h,0beh,0e0h,0feh,0f6h   ;0,1,2,3,4,5,6,7,8,9
    end

⌨️ 快捷键说明

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