Advertisement
electronicosembebido

Untitled

Jul 21st, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;*******************************************************************************
  2. ;                                                                              *
  3. ;    Filename:  Proyecto 3                                                     *
  4. ;    Date:      21/01/2017                                                     *
  5. ;    File Version:   0.01                                                      *
  6. ;    Author:    Mariano Rocha                                                  *
  7. ;    Company:   Electronicos embebidos                                         *
  8. ;    Description: Led Barr                                                   *
  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. INICIO
  28.     BANKSEL PORTB
  29.     clrf    PORTB
  30.     BANKSEL ANSELB
  31.     clrf    ANSELB
  32.     BANKSEL TRISB
  33.     clrf    TRISB
  34.    
  35.     BANKSEL PORTB
  36.    
  37. BUCLE:
  38.     clrf    cont
  39.     movf    cont,w
  40.     movwf   PORTB
  41.    
  42.     call    DEMORA
  43.     incf    cont,f    
  44.     movf    cont,w    
  45.     sublw   .10
  46.     btfss   STATUS,Z
  47.     goto    BUCLE+1
  48.     goto    BUCLE
  49.    
  50.    
  51.    
  52.  
  53.      
  54. ;-------------------------------------------------------------
  55. DEMORA  movlw     .6       ; 1 set numero de repeticion  (C)
  56.         movwf     PDel0     ; 1 |
  57. PLoop0  movlw     .72       ; 1 set numero de repeticion  (B)
  58.         movwf     PDel1     ; 1 |
  59. PLoop1  movlw     .247      ; 1 set numero de repeticion  (A)
  60.         movwf     PDel2     ; 1 |
  61. PLoop2  clrwdt              ; 1 clear watchdog
  62.         decfsz    PDel2, 1  ; 1 + (1) es el tiempo 0  ? (A)
  63.         goto      PLoop2    ; 2 no, loop
  64.         decfsz    PDel1,  1 ; 1 + (1) es el tiempo 0  ? (B)
  65.         goto      PLoop1    ; 2 no, loop
  66.         decfsz    PDel0,  1 ; 1 + (1) es el tiempo 0  ? (C)
  67.         goto      PLoop0    ; 2 no, loop
  68. PDelL1  goto PDelL2         ; 2 ciclos delay
  69. PDelL2  clrwdt              ; 1 ciclo delay
  70.         return              ; 2+2 Fin.
  71. ;-------------------------------------------------------------  
  72.      
  73. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement