Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pic 16 1.56 KB | None | 0 0
  1. ; TODO INSERT CONFIG CODE HERE USING CONFIG BITS GENERATOR
  2.     LIST P=12LF1822
  3.     #include <p12lf1822.inc>
  4.     __CONFIG _CONFIG1, _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
  5.     __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_19 & _LVP_ON
  6.    
  7.    
  8.    
  9. RES_VECT  CODE    0x0000            ; processor reset vector
  10.     GOTO    START                   ; go to beginning of program
  11.  
  12.  
  13. count   equ     0x03 ;
  14. i   equ     0x00 ;
  15.  
  16.    
  17.    
  18. ; TODO ADD INTERRUPTS HERE IF USED
  19.  
  20. MAIN_PROG CODE                      ; let linker place main program
  21.    
  22.    
  23. START
  24.     ; start from bank 0
  25.     bcf     FSR0,   d'0'
  26.    
  27.     banksel PORTA
  28.     clrf    PORTA
  29.     banksel LATA
  30.     clrf    LATA
  31.     banksel ANSELA
  32.     clrf    ANSELA
  33.     banksel WPUA
  34.     ;clrf    WPUA
  35.     movlw   H'0A'
  36.     movwf   WPUA
  37.     banksel TRISA
  38.     clrf    TRISA
  39.     bsf     TRISA,d'1'
  40.     ;bsf        TRISA,d'3'
  41.     movlw   d'0'
  42.     ;PIC Time Delay = 1.0000000 s with Osc = 4.000000 MHz
  43.     banksel OPTION_REG
  44.     clrf    OPTION_REG
  45.     banksel APFCON
  46.     clrf    APFCON
  47.  
  48.  
  49. LOOP
  50.     banksel PORTA
  51.     btfss   PORTA, d'1'
  52.     ;movlw   PORTA
  53.     ;andlw   b'00000010'
  54.     ;btfsc   STATUS, d'2'; if (PORTA.RA1)
  55.     goto    SET_LED_0
  56. SET_LED_1
  57.     banksel LATA
  58.     movlw   b'00110000'
  59.     movwf   LATA
  60.     goto    SET_LED_END
  61. SET_LED_0
  62.     banksel LATA
  63.     movlw   b'00000000'
  64.     movwf   LATA
  65.     ;goto    SET_LED_END
  66. SET_LED_END
  67.     GOTO LOOP
  68.    
  69.     GOTO $                          ; loop forever
  70.  
  71.        
  72.     END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement