#include	<16F1938.h>
#zero_ram
#fuses	INTRC_IO,PLL,NOWDT,PUT,WRT,noCPD,noPROTECT,MCLR,BROWNOUT,BORV25,STVREN,NOIESO,NOFCMEN,NOLVP,NODEBUG,NOCLKOUT,NOVCAP
#use delay(clock=16000000)
#use rs232(baud=9600, parity=N, XMIT=PIN_B7, RCV=PIN_B6, bits=8)
//#USE RS232(BAUD=2400, XMIT=PIN_B7, RCV=PIN_B6, parity=N, bits=8, errors)		//3ms timeout

#include <lcd.c>

#define		LED			PIN_B3
#define		CTR			PIN_C2

char	rsrx	=	0;

#INT_RDA 
void RS232() { 
	output_low(led);
	rsrx=getc();
}

void main() {
	setup_oscillator(OSC_INTRC|OSC_16MHZ|OSC_PLL_ON);
	delay_ms(150);
	setup_spi(FALSE);
	output_low(ctr);
	lcd_init();
	output_high(led);
	lcd_putc("\frs232 teszt");
	delay_ms(500);
	lcd_putc("\f");
//
	enable_interrupts(INT_RDA);
	enable_interrupts(global);
//
	for (;;) {
		delay_ms(500);
		lcd_gotoxy(1,1);
		printf(lcd_putc,"%i", rsrx);
	}
}
