Advertisement
electronicosembebido

Untitled

Jul 21st, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;*******************************************************************************
  2. ;                                                                              *
  3. ;    Filename:  Proyecto 4                                                     *
  4. ;    Date:      21/01/2017                                                     *
  5. ;    File Version:   0.01                                                      *
  6. ;    Author:    Mariano Rocha                                                  *
  7. ;    Company:   Electronicos embebidos                                         *
  8. ;    Description: display tabla                                                *
  9. ;                                                                              *
  10. ;*******************************************************************************
  11. ;*******************************************************************************
  12. ; MAIN PROGRAM
  13. ;*******************************************************************************
  14.  
  15. LIST P=16f1827
  16. RADIX HEX
  17. include  "P16f1827.inc"
  18. __CONFIG _CONFIG1, _FOSC_XT & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_ON & _FCMEN_ON    
  19. __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_ON
  20.     ORG 0
  21.    
  22. CBLOCK 0X20
  23. PDel0, PDel1, PDel2    
  24. cont
  25. ENDC    
  26.    
  27.  
  28.     ORG 0
  29.     goto INICIO
  30.    
  31. tabla:    
  32.     BRW
  33.     retlw   B'00111111' ;0
  34.     retlw   B'00000110' ;1
  35.     retlw   B'01011011' ;2
  36.     retlw   B'01001111' ;3
  37.     retlw   B'01100110' ;4
  38.     retlw   B'01101101' ;5
  39.     retlw   B'01111101' ;6
  40.     retlw   B'00000111' ;7
  41.     retlw   B'01111111' ;8
  42.     retlw   B'01101111' ;9
  43.    
  44.     goto $        
  45.  
  46. INICIO:    
  47.     BANKSEL PORTB
  48.     clrf    PORTB
  49.     BANKSEL ANSELB
  50.     clrf    ANSELB
  51.     BANKSEL TRISB
  52.     clrf    TRISB
  53.    
  54.     BANKSEL PORTB
  55.    
  56. BUCLE:  
  57.     clrf    cont
  58.     movf    cont,w
  59.     call    tabla
  60.     movwf   PORTB    
  61.    
  62.     call    DEMORA
  63.     incf    cont,f    
  64.     movf    cont,w    
  65.     sublw   .10
  66.     btfss   STATUS,Z
  67.     goto    BUCLE+1
  68.     goto    BUCLE
  69.    
  70.    
  71.    
  72.  
  73.      
  74. ;-------------------------------------------------------------
  75. DEMORA  movlw     .6       ; 1 set numero de repeticion  (C)
  76.         movwf     PDel0     ; 1 |
  77. PLoop0  movlw     .72       ; 1 set numero de repeticion  (B)
  78.         movwf     PDel1     ; 1 |
  79. PLoop1  movlw     .247      ; 1 set numero de repeticion  (A)
  80.         movwf     PDel2     ; 1 |
  81. PLoop2  clrwdt              ; 1 clear watchdog
  82.         decfsz    PDel2, 1  ; 1 + (1) es el tiempo 0  ? (A)
  83.         goto      PLoop2    ; 2 no, loop
  84.         decfsz    PDel1,  1 ; 1 + (1) es el tiempo 0  ? (B)
  85.         goto      PLoop1    ; 2 no, loop
  86.         decfsz    PDel0,  1 ; 1 + (1) es el tiempo 0  ? (C)
  87.         goto      PLoop0    ; 2 no, loop
  88. PDelL1  goto PDelL2         ; 2 ciclos delay
  89. PDelL2  clrwdt              ; 1 ciclo delay
  90.         return              ; 2+2 Fin.
  91. ;-------------------------------------------------------------  
  92.      
  93. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement