/*
 * File:   UART.h
 * Author: hamilton
 *
 * Created on January 15, 2014, 3:54 PM
 */

#ifndef UART_H
#define	UART_H
#define BRATE2  256 //9600 Baud (BRGH = 0) w/39.6175MhZ clock
#define BRATE1 257    //38400 Baud (BRGH = 1)  w/39.6175MhZ clock
#define BRATE 85    //115200 Baud (BRGH = 1)
#define U_ENABLE_H 0x8808  //enable the UART Peripheral with BRGH = 1
#define U_ENABLE_L 0x8800  //enable the UART Peripheral with BRGH = 0;
#define U_NOFLOWCONTROL 0x0000
#define U_TX  0x0400  //Enable transmission


#define CTS1 _RD14
#define RTS1 _RD15
#define TRTS1 TRISDbits.TRISD15

#define CTS2 _RF12
#define RTS2 _RF13
#define TRTS2 TRISFbits.TRISF13


void InitU1(void);
void InitU2(void);
int putU1( int c);
void putsU1(char *s);
char getU1(void);
int putU2( int c);
void putsU2(char *s);
char getU2(void);


#endif	/* UART_H */

