; BINARY COUNTER IN LEDS FOR BOLT 18F2550
; EXTERNAL CRYSTAL IS 20 MHZ FUT EFFECTIVE
; FREQUENCY IS 48 MHX DUE TO PLL MULTIPLIERS 
; TO SIMULATE PROGRAM IN MPLAB, ORG=0
; PARA EXECUTE PROGRAM IN BOLT, ORG=0x800

	processor 18F2550
	include	  <p18F2550.inc>

J	equ	H'80'	  
K	equ	H'81'
L	equ H'82'	 
			org 0x800
			clrf	TRISA
			clrf	TRISB			 			
inicio:		clrf	PORTB
			clrf	PORTA
increment:	incf	PORTB,F			
			call	retrobolt						
			goto	increment

	; RETRASO APROX DE 16.4 x L MILISEGUNDOS

retrobolt:	movlw	D'61'	;valor de L
			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	

