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

📄 boxing.asm

📁 一款12F629的信号发生器的源程序
💻 ASM
字号:
include "P12F629.INC"

MK equ 21h
BG equ 22h
COU1 equ 23h
COU2 equ 24h

org 0000h
goto main


Hardinit:
         movlw 0x20
         movwf STATUS
         movlw 0x00
         movwf INTCON
         movlw 0x80
         option
         movlw OSCCAL
         movlw 0x80
         movwf OSCCAL
         movlw 0x38
         movwf TRISIO
         retlw 0

DelayMK:movf MK,0
        movwf COU1
DE1:    decfsz COU1,1
        goto   DE1
        retlw 0

DelayBG:movf BG,0
        movwf COU2
DE2:    decfsz COU2,1
        goto   DE2
        retlw 0

CycleSend:bsf GPIO,2
          bsf GPIO,1
          call DelayMK
          bcf GPIO,2
          bcf GPIO,1
          call DelayBG
          bsf GPIO,1
          call DelayMK
          bcf GPIO,1
          call DelayBG
          retlw 0

ScanPort:btfsc GPIO,5
         goto F1xx
         btfsc GPIO,4
         goto F01x
         btfsc GPIO,3
         goto F001
         movlw 10
         movwf BG; 000
         goto Tend
F001:    movlw 20
         movwf BG; 001
         goto Tend
F01x:    btfsc GPIO,3
         goto F011
         movlw 30
         movwf BG; 010
         goto Tend
F011:    movlw 40
         movwf BG; 011
         goto Tend
F1xx:    btfsc GPIO,4
         goto F11x
         btfsc GPIO,3
         goto F101
         movlw 50
         movwf BG; 100
         goto Tend
F101:    movlw 60
         movwf BG; 101
         goto Tend
F11x:    btfsc GPIO,3
         goto F111
         movlw 70
         movwf BG; 110
         goto Tend
F111:    movlw 80
         movwf BG; 111
Tend:    retlw 0

main:
call Hardinit
movlw 20
movwf MK
movlw 0x00
movwf STATUS
XH:
call ScanPort
bcf GPIO,2
bsf GPIO,1
nop
nop
nop
nop
nop
bcf GPIO,1
nop
nop
nop
nop
nop
call CycleSend
call CycleSend
call CycleSend
goto XH

end

⌨️ 快捷键说明

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