Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; TODO INSERT CONFIG CODE HERE USING CONFIG BITS GENERATOR
- LIST P=12LF1822
- #include <p12lf1822.inc>
- __CONFIG _CONFIG1, _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
- __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_19 & _LVP_ON
- RES_VECT CODE 0x0000 ; processor reset vector
- GOTO START ; go to beginning of program
- count equ 0x03 ;
- i equ 0x00 ;
- ; TODO ADD INTERRUPTS HERE IF USED
- MAIN_PROG CODE ; let linker place main program
- START
- ; start from bank 0
- bcf FSR0, d'0'
- banksel PORTA
- clrf PORTA
- banksel LATA
- clrf LATA
- banksel ANSELA
- clrf ANSELA
- banksel WPUA
- ;clrf WPUA
- movlw H'0A'
- movwf WPUA
- banksel TRISA
- clrf TRISA
- bsf TRISA,d'1'
- ;bsf TRISA,d'3'
- movlw d'0'
- ;PIC Time Delay = 1.0000000 s with Osc = 4.000000 MHz
- banksel OPTION_REG
- clrf OPTION_REG
- banksel APFCON
- clrf APFCON
- LOOP
- banksel PORTA
- btfss PORTA, d'1'
- ;movlw PORTA
- ;andlw b'00000010'
- ;btfsc STATUS, d'2'; if (PORTA.RA1)
- goto SET_LED_0
- SET_LED_1
- banksel LATA
- movlw b'00110000'
- movwf LATA
- goto SET_LED_END
- SET_LED_0
- banksel LATA
- movlw b'00000000'
- movwf LATA
- ;goto SET_LED_END
- SET_LED_END
- GOTO LOOP
- GOTO $ ; loop forever
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement