; FLASH LED 0 EACH SECOND
; EXTERNAL CRYSTAL IS 20 MHZ BUT EFFECTIVE
; FREQUENCY IS 48 MHZ DUE TO PLL MULTIPLIERS 
; INSTRUCTION CYCLE IS 83.3 NANOSECONDS
; TO SIMULATE PROGRAM IN MPLAB, ORG=0
; PARA EXECUTE PROGRAM IN BOLT, ORG=0x800

	processor 18F2550
	include	  <p18F2550.inc>
	include	 "KEYBOLT.inc"

J	equ	H'80'	  
K	equ	H'81'
L	equ H'82'
	 
		org 	0x800	;MODIFIQUE A ORG=0 PARA SIMULAR EN MPLAB
		PUERTOS
;FIN DE INICIALIZACION DE PUERTOS

malla:	bsf		LED0
		call	retrobolt
		bcf		LED0
		call	retrobolt
		goto	malla





;DELAY SUBROUTINE (16.4 x L) MILISECONDS

retrobolt:	movlw	D'61'	;valor de L. Modifique para cambiar el valor del retraso.
		movwf	L
lloop		movlw	D'255'	; w := 200 decimal
		movwf	J	; J := w
jloop:		movwf	K	; K := w
kloop:		decfsz	K,f	; K = K-1, skip next if zero
		goto 	kloop
		decfsz	J,f	; J = J-1, skip next if zero
		goto	jloop
		decfsz	L,f
		goto	lloop
		return


		end	

