 list       F=inhx32, P=16F1936, R=hex, N=0
#include  P16F1936.inc; PIC definitions
 __config _config1,_FCMEN_OFF  & _IESO_OFF & _CLKOUTEN_OFF & _BOREN_OFF  & _CPD_OFF & _CP_OFF & _MCLRE_ON  & _PWRTE_OFF & _WDTE_OFF & _FOSC_INTOSC
 __config _config2,_LVP_OFF  & _BORV_25 & _STVREN_OFF & _PLLEN_OFF & _VCAPEN_OFF & _WRT_OFF
 Errorlevel -302, -224
;------------------------------------------------------------------------------------------------------------------------------------------------


       	org     0x000
        goto    init

		org		0x004
		bsf		PORTC,2			;signalizace přerušení
		goto	START


init	movlb 	0x01
		movlw	b'01101000'
		movwf 	OSCCON
		movlb 	0x00
		clrf 	PORTA
		clrf 	PORTB
		clrf 	PORTC
		movlb 	0x01
		movlw 	b'11111111'		
		movwf 	TRISA			
		movlw 	b'00000000'	
		movwf 	TRISB
		movlw	b'10000000'	
		movwf 	TRISC		
		movlb 	0x03
		clrf 	ANSELA
		clrf 	ANSELB
	   	movlb	0x03
   		movlw   .25     
   		movwf   SPBRGL
   		clrf   	SPBRGH
   		movlw   B'01000000' 
   		movwf   BAUDCON
		bsf		BAUDCON,BRG16
   		movlw   B'00100010'
   		movwf   TXSTA
   		movlw   B'10010000'
   		movwf   RCSTA
		movlb	0x01
		bsf 	PIE1,RCIE
   		movlb	0x00
		movlw	0xC0
		movwf	INTCON




loop
		incfsz	21h,1
		goto	loop
		bcf		PORTC,2
		goto	loop








START
		movlb	0x03
		btfss	PIR1,RCIF		;ceka na prichozi data (dokud neni naplnen RCREG)
		goto	START
		movlb	0x03	
		movfw	RCREG
		movlb	0x00
		movwf	20h
		movlw	0xAA
		subwf	20h,1
		btfsc	STATUS,Z
		bsf		PORTC,3
		return

end