Advertisement
electronicosembebido

Mplabx 2017 PIC16F1827 ASM Led Blink

Jul 21st, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;*******************************************************************************
  2. ;                                                                              *
  3. ;    Filename:  Proyecto 1                                                     *
  4. ;    Date:      21/01/2017                                                     *
  5. ;    File Version:   0.01                                                      *
  6. ;    Author:    Mariano Rocha                                                  *
  7. ;    Company:   Electronicos embebidos                                         *
  8. ;    Description: Led Blink                                                    *
  9. ;                                                                              *
  10. ;*******************************************************************************
  11. ; MAIN PROGRAM
  12. ;*******************************************************************************
  13.  
  14. LIST P=16f1827
  15. RADIX HEX
  16. include  P16f1827.inc
  17. __CONFIG _CONFIG1, _FOSC_XT & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_ON & _FCMEN_ON    
  18. __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_ON
  19.     ORG 0
  20.    
  21. CBLOCK 0X20
  22. PDel0, PDel1, PDel2    
  23. ENDC    
  24.    
  25. INICIO
  26.     BANKSEL PORTB
  27.     clrf    PORTB
  28.     BANKSEL ANSELB
  29.     clrf    ANSELB
  30.     BANKSEL TRISB
  31.     clrf    TRISB
  32.    
  33.     BANKSEL PORTB
  34.  BUCLE
  35.     bsf     PORTB,0
  36.     call    DEMORA
  37.     bcf     PORTB,0
  38.     call    DEMORA
  39.    
  40.     goto    BUCLE
  41.    
  42.    
  43.       goto INICIO
  44.      
  45. ;-------------------------------------------------------------
  46. DEMORA  movlw     .14       ; 1 set numero de repeticion  (C)
  47.         movwf     PDel0     ; 1 |
  48. PLoop0  movlw     .72       ; 1 set numero de repeticion  (B)
  49.         movwf     PDel1     ; 1 |
  50. PLoop1  movlw     .247      ; 1 set numero de repeticion  (A)
  51.         movwf     PDel2     ; 1 |
  52. PLoop2  clrwdt              ; 1 clear watchdog
  53.         decfsz    PDel2, 1  ; 1 + (1) es el tiempo 0  ? (A)
  54.         goto      PLoop2    ; 2 no, loop
  55.         decfsz    PDel1,  1 ; 1 + (1) es el tiempo 0  ? (B)
  56.         goto      PLoop1    ; 2 no, loop
  57.         decfsz    PDel0,  1 ; 1 + (1) es el tiempo 0  ? (C)
  58.         goto      PLoop0    ; 2 no, loop
  59. PDelL1  goto PDelL2         ; 2 ciclos delay
  60. PDelL2  clrwdt              ; 1 ciclo delay
  61.         return              ; 2+2 Fin.
  62. ;-------------------------------------------------------------  
  63.      
  64. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement