Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list p=16F887, r=dec, w=-302
- include <P16F887.INC>
- __config _CONFIG1,_LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO
- __config _CONFIG2,_WRT_HALF & _BOR21V
- #define LED0 PORTD,0
- cblock 0x20
- COUNT1
- COUNT2
- endc
- org 0x000 ;reset vector
- goto START
- START clrf PORTA ;init ports
- clrf PORTB
- clrf PORTC
- clrf PORTD
- clrf PORTE
- banksel ANSEL ;bank 3
- movlw b'00000000' ;all ports digital I/O
- movwf ANSEL
- movwf ANSELH
- banksel TRISA ;bank 1
- movlw b'00000000' ;all ports output
- movwf TRISA
- movwf TRISB
- movwf TRISC
- movwf TRISD
- movwf TRISE
- movlw b'11010111' ;tmr0 clock source = instruction clock
- movwf OPTION_REG ;1:256 prescale
- banksel 0x00 ;bank 0
- clrf TMR0 ;init tmr0
- bcf INTCON,T0IF ;clear tmr0 interrupt flag
- btfss INTCON,T0IF ;is tmr0 interrupt flag high?
- goto $-1 ;no, check again
- movlw b'00000001' ;toggle LED0
- xorwf PORTD,F
- goto $-6 ;do forever
- end ;end of file
Add Comment
Please, Sign In to add comment