#ifndef _SERIAL_H_
#define _SERIAL_H_

#define BAUD0 9600
#define FSYS 16000000L
#define NINE 0     /* Use 9bit communication? FALSE=8bit */

#define DIVIDER0 ((int)(FSYS/(16UL * BAUD0)))
//#define DIVIDER  1
#define HIGH_SPEED 1

#if NINE == 1
#define NINE_BITS 0x40
#else
#define NINE_BITS 0
#endif

#if HIGH_SPEED == 1
#define SPEED 0x4
#else
#define SPEED 0
#endif

#define RX0_PIN TRISB1
#define TX0_PIN TRISB2
#define BGRMOD 0X0000


/* Serial initialization
#define init_comms()\
	RX_PIN = 1;	\
	TX_PIN = 0;		  \
	SPBRG = DIVIDER;   	\
	RCSTA = (NINE_BITS|0x90);	\
	TXSTA = (SPEED|NINE_BITS|0x20)
//RCSTA = 0X90;
//TXSTA=0X20;
 */



//#define RX0_PIN TRISB2
//#define TX0_PIN TRISB1
void usart0_init();
void putch(unsigned char);
unsigned char getch(void);
unsigned char getche(void);


#endif
