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

📄 shuma.asm

📁 PIC单片机PIC16F630写的动态数码管
💻 ASM
字号:
 list p=16f57,r=dec
 #INCLUDE"P16F5X.INC"
 __CONFIG _CP_ON & _WDT_OFF & _XT_OSC
;------------------------------------
tmr0    equ  01h
STATUS  equ  03h
PORTA   equ  05h
PORTB   equ  06h
PORTC   equ  07h
count   equ  10h
count1  equ  11h
disp    equ  12h
l1      equ  13h
l2      equ  14h
l3      equ  15h
d1   equ   16h
d2   equ   17h
d3   equ  18h
d4   equ  19h
;-----------------------------------
   org  0000h
   nop 
   goto  main
;-------------------------
disp_1:
   movwf  PCL
table
   retlw  60h  ;0
   retlw  0edh ;1
   retlw  0b0h ;2
   retlw  0a4h ;3
   retlw  2dh  ;4
   retlw  26h  ;5
   retlw  22h  ;6
   retlw  0ech ;7
   retlw  20h  ;8
   retlw  24h  ;9

;---------------------------
DELAY:
     movlw  40
     movwf  l1
lo:
     movlw  50
     movwf  l2
lo1:
    decfsz  l2,f
    goto   lo1
    decfsz   l1,f
    goto  lo
    retlw   .0
timer:
    btfss   tmr0,7
    goto   exit
    clrf   tmr0
    incf    d1,f
    movlw   10
    subwf   d1,w
    btfss  STATUS,0
    goto   exit
    clrf   d1
    incf   d2,f
exit:
    retlw   .0
;-----------------------------
main:
   clrw 
   tris  5     ;PORTA
   tris  6     ;PORTB
   tris  7     ;PORTC
   movlw  06h
   option      ;TMR0,1:128
   bsf   PORTA,1
   bsf   PORTA,2
   bsf   PORTC,1
   movlw  0ffh
   movwf  PORTB  
   movlw  table
   movwf  disp
   clrw
   clrf  count
   clrf  count1
loop:
   movlw   .10
   movwf   d4
loop1:
   movlw   .10
   movwf   d3
loop2:
   call   timer
   bcf   PORTA,3
   movf   count,w
   addwf  disp,w
   call   disp_1
   movwf  PORTB
   call   DELAY
   bsf   PORTA,3
   movf  count1,w
   addwf  disp,w
   call   disp_1
   movwf  PORTB
   bcf    PORTB,5
   call   DELAY  
   movlw   .2
   subwf   d2,w
   btfss   STATUS,0
   goto  loop2
   clrf   d2
   incf   count,f
   decfsz  d3,f
   goto   loop2
   clrf   count
   incf   count1,f
   decfsz   d4,f
   goto   loop1
   clrf   count1
   goto   loop
;-------------
   end
   
   
   
   
   

⌨️ 快捷键说明

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