Hi
I am having problems with getting an LED to flash on a 16F887. I believe it is down to the oscillator.
can you point me in the right direction?
__CONFIG _CONFIG1, _LVP_OFF & _FCMEN_ON & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC
__CONFIG _CONFIG2, _WRT_OFF & _BOR21V
;*****Set up the Constants****
STATUS equ 03h ;Address of the STATUS register
TRISA equ 85h ;Address of the tristate register for port A
PORTA equ 05h ;Address of Port A
COUNT1 equ 21h ;First counter for our delay loops
COUNT2 equ 22h ;Second counter for our delay loops
ANSEL equ 188h ;Address for OSC setup
start
;****Set up the port****
BSF STATUS,5 ;Switch to Bank 1
BANKSEL PORTA
CLRF PORTA
BANKSEL ANSEL
CLRF ANSEL
BANKSEL TRISA
movlw B'00000000' ;Set the Port A pins
movwf TRISA ;to output.
bcf STATUS,5 ;Switch back to Bank 0
;****Turn the LED on****
Start
BSF PORTA,0 ;it into the w register and then
Call delay
BCF PORTA,0 ;it into the w register and then ;on the port
Call delay
Goto Start
;****Start of the delay loop 1****
delay
decfsz COUNT1,1 ;Subtract 1 from 255
goto delay ;If COUNT is zero, carry on.
decfsz COUNT2,1 ;Subtract 1 from 255
goto delay ;Go back to the start of our loop. ;This delay counts down from ;255 to zero, 255 times
end