#ifndef	__USART1_H
#define	__USART1_H



void WriteLED(unsigned char oLED);
//unsigned char ReadSW(void);
void InitPic(void);
void SetupUSART(void);

//*******************************************************************//
//Constant Definitions
//*******************************************************************//

#define	TRUE		1
#define	FALSE		0
#define	PASS		1
#define	FAIL		0
//#define	ON			1
//#define	OFF			0

//LEDEK
#define	INIT_TRISD	0b11110001	
#define DIN_TRISD	0b11111111
#define DOUT_TRISD	INIT_TRISD
#define	INIT_PORTD	0b00001110	// port kezdoerteke

#define	DS2_IN	PORTDbits.RD1	//	IN
#define	DS2_OUT	LATDbits.LATD1	//	OUT
#define	DS3_IN	PORTDbits.RD2	//	IN
#define	DS3_OUT	LATDbits.LATD2	//	OUT
#define	DS4_IN	PORTDbits.RD3	//	IN
#define	DS4_OUT	LATDbits.LATD3	//	OUT
//#define	TMP1	PORTDbits.RD4	//	ANALOG IN
//#define	MCLR	PORTDbits.RD5	//	IN

//USART és I2C
#define	INIT_TRISC	0b10110110
#define DIN_TRISC	0b10110111
#define DOUT_TRISC	INIT_TRISC
#define	INIT_PORTC	0b00000000	// port kezdoerteke


#define	DS1_IN	PORTDbits.RD0	//	IN
#define	DS1_OUT	LATDbits.LATD0	//	OUT
#define	PIC_TX	PORTCbits.RC6	//	OUTPUT
//#define	TX_EN	PORTBbits.RB2	//	OUTPUT
//#define	RX_EN	PORTBbits.RB3	//	OUTPUT
#define	PIC_RX	PORTCbits.RC7	//	INPUT
//#define	PGM		PORTBbits.RB5	//	NA
//#define	PGC		PORTBbits.RB6	//	NA
//#define	PGD		PORTBbits.RB7	//



#define	OSC_SPEED 	10000000		// 10 MHz(PIC oscillator speed)
#define	USART_BAUD 	19200			// BaudRate
#define	BRGH_HIGH	0				//

#if BRGH_HIGH == 1
	#define	USART_SPEED	(((OSC_SPEED/USART_BAUD)/16)-1)
	#define	USART_BRGH		USART_BRGH_HIGH
#else
	#define	USART_SPEED	(((OSC_SPEED/USART_BAUD)/64)-1)
	#define	USART_BRGH		USART_BRGH_LOW
#endif
