		; list directive to define processor
		list      p=12f629            
		; processor specific variable definitions
		#include <p12f629.inc>        

		__CONFIG   	_CP_OFF & _MCLRE_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT & _BODEN_OFF & _CPD_OFF &_PWRTE_OFF
	
#DEFINE	LED		GPIO,0	
#DEFINE LED_IO	TRISIO,0

CNT0	EQU		20H
CNT1	EQU		21H
CNT2	EQU		22H
;---------------------------------
		ORG		0000H
			
		MOVLW 	07H	
		MOVWF 	CMCON		; TURN-OFF analog comparator 
	
		BSF		STATUS,RP0	; select bank 1
		CALL	3FFH		; Load cal value
		MOVWF	OSCCAL
		BCF		LED_IO		; set as output
		BCF		STATUS,RP0	; select bank 0
				
LOOP:	BSF		LED
		CALL	DELAY
		BCF		LED
		CALL	DELAY
		GOTO	LOOP		
		
;---------------------------------
; DELAY 0.5 SECONDS ROUTINE
;--------------------------------- 
DELAY:	MOVLW	03H
		MOVWF	CNT0
		MOVLW	18H
		MOVWF	CNT1
		MOVLW	02H
		MOVWF	CNT2
Delay_0
		DECFSZ	CNT0, f
		GOTO	$+2
		DECFSZ	CNT1, f
		GOTO	$+2
		DECFSZ	CNT2, f
		GOTO	Delay_0

		;6 cycles
		GOTO	$+1	;delay 2 cycles
		GOTO	$+1	;delay 2 cycles
		GOTO	$+1	;delay 2 cycles
		;4 cycles (including call)
		RETURN
		
		END

