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
#include <p16F887.inc>
radix dec
errorlevel 1, -305
__CONFIG _CONFIG1, _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT
__CONFIG _CONFIG2, _WRT_OFF & _BOR21V
CBLOCK 0x20

c3
c4
ENDC
ORG 0
clrf PCLATH
goto Main
ORG 4

Main:
bsf STATUS, RP0 ; Bank 1
bcf TRISD, 4 ; Pin 4 output (5th LED)
bcf STATUS, RP0 ; Bank 0
clrf PORTD

rep:
bcf PORTD, 4 ; LED off
call Delay
bsf PORTD, 4 ; LED on
call Delay
goto rep

Delay: ;delay 150ms
movlw 200
movwf c3 
rep1:
call delayx
decfsz c3
goto rep1
return
delayx:
movlw 255
movwf c4
rep2:
decfsz c4
goto rep2
return
END

try that !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.