	LIST P=24FJ256GB106, F=INHX32

	#include "P24FJ256GB106.INC"

  
	cblock
	d1
	d2
	d3
	endc

	org		0
	goto	Debut

	org		10
Debut
	movlw	0
	movwf	LATC
	movwf	LATD
	movwf	TRISD					; PortD kimenet
	movlw	0xFE
	movwf	TRISC					; PortC en sortie
	clrf	LATC

Boucle

;	call	Delay05
	bsf		LATC,0
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
;	call	Delay05
	bcf		LATC,0
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	goto	Boucle


; Delay = 0.5 seconds
; Clock frequency = 20 MHz

; Actual delay = 0.5 seconds = 2500000 cycles
; Error = 0 %

Delay05
			;2499999 cycles
	movlw	0x16
	movwf	d1
	movlw	0x74
	movwf	d2
	movlw	0x06
	movwf	d3
Delay_0
	decfsz	d1, f
	nop
	incf	LATD, 1					; Increment port D
	decfsz	d2, f
	goto	$+2
	decfsz	d3, f
	goto	Delay_0

			;1 cycle
	nop
	return

	end