	include <p18f4520.inc>


	ORG	0x00
	goto	init

	ORG	0x08


init
	bcf	TRISC, 2	;CCP1 pin as output

	movlw	0xFF
	movwf	PR2		;set PWM period to full

	movlw	B'00101111'	;configure CCP1 to PWM
	movwf	CCP1CON		;and set lsb of duty cycle to 10

	movlw	B'01100110'
	movwf	CCPR1L		;40% duty cycle

	bsf	T2CON, 2	;turn on TMR2
	bcf	T2CON, 1	;prescale bits
	bsf	T2CON, 0	;prescale 1:4

	goto	main

main
	goto	main

	END