
	list       F=inhx8m, P=18F14K22, R=hex, N=0
 	errorlevel -302  
	#include "P18F14K22.INC"
      

;*****************************************************************************
;*****************************************************************************
 start
	call	init

	BSF		CCP1CON,DC1B0,0	;HORNI DVA BITY PRO PWM - HODNOTA "H"
	BSF		CCP1CON,DC1B1,0
	MOVLW	.250			;SPODNICH 8 BITU PRO PWM
	MOVWF	CCPR1L,0		;SPOLU S DC1B0, DC1B1 => 10-BIT. ROZLISENI
	GOTO	$-0

init 
	nop
	MOVLW	B'00000000'	;internal osC
	MOVWF	OSCTUNE
	MOVLW	B'01010000'	;4MHz
	MOVWF	OSCCON,0
	MOVLW	B'00000000'
	MOVWF	OSCCON2,0
	CLRF	PORTC
	CLRF	LATC
	MOVLW	B'00000000'
	MOVWF	TRISC,0	
	BCF		ANSEL,ANS6	;RC2 = digital
	MOVLW	B'00111100'	;nast. modulu CCP do rezimu PWM + nast. hodnoty bitů CCP1CON <5,4>
	MOVWF	CCP1CON,0	;(nejvyssi dva bity 10-bitoveho slova pro nast. duty cyklu)
	MOVLW	.255		;nastaveni PWM periody
	MOVWF	PR2,0

	movlw       b'00000111' ;aktivace TIMER2, nastavení předděličky
	movwf       T2CON,0

	return

	end
