; BOLT ASSEMBLER TEMPLATE
; INITIALIZE PORTS, TO WORK WITH LEDS,
; MICROSWITCHES AND RELAY
; EXTERNAL CRYSTAL OF 18F2550 IS 20 MHZ
; BUT EFFECTIVE FREQUENCY IS 48 MHZ
; DUE TO PLL MULTIPLIERS.
; INSTRUCTION CYCLE IS 83.3 NANOSECONDS
; TO RUN SIMULATOR IN MPLAB, MODIFY ORG=0
; TO EXECUTE PROGRAM IN BOLT 18F2550, ORG=800

	processor 18F2550
	include	  <p18F2550.inc>
	include	 "KEYBOLT2.inc"	;AUXILIARY FILE

J	equ	H'80'	  
K	equ	H'81'
L	equ 	H'82'
	 
		org 	0x800	;MODIFY TO ORG=0 TO SIMULATE IN MPLAB
		PUERTOS
;PORT MACRO INITIALIZATION

;USER PROGRAM GOES HERE


;DELAY SUBROUTINE APROX. 1 SEG. MODIFY IF NEEDED -> (16.4 x L) MS

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	

