Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <usart.h>
- #include "xport.h"
- #include "defines.h"
- /* XPORT DEFAULTS:
- Baud: 9600
- Databits: 8
- Parity: none
- Stop bits: 1*/
- void xportSetup(void){
- BAUDCON2 = 1;
- RCSTA2bits.SPEN = 1;
- TRISGbits.TRISG2 = 1;
- TRISGbits.TRISG1 = 0;
- Open2USART( USART_TX_INT_OFF & // Transmit Interrupt OFF
- USART_RX_INT_OFF & // Receive Interrupt ON
- USART_ASYNCH_MODE & // Asynchronous Mode
- USART_EIGHT_BIT & // 8-bit Transmit/Receive
- USART_CONT_RX & // Continuous Reception
- USART_BRGH_HIGH, // High Baud Rate
- (64E6 / 9600 / 16 - 1) // Baud Rate 9600
- );
- //http://www.microchip.com/forums/FindPost/836738
- }
- void xportEnable(void){
- LDO_SHDN = true;
- XRESET = true;
- }
- void xportSend(char data){
- Write2USART(data);
- }
- char xportReceive(void){
- return Read2USART();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement