Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include <usart.h>
  2. #include "xport.h"
  3. #include "defines.h"
  4.  
  5. /* XPORT DEFAULTS:
  6. Baud: 9600
  7. Databits: 8
  8. Parity: none
  9. Stop bits: 1*/
  10.  
  11. void xportSetup(void){
  12. BAUDCON2 = 1;
  13. RCSTA2bits.SPEN = 1;
  14. TRISGbits.TRISG2 = 1;
  15. TRISGbits.TRISG1 = 0;
  16. Open2USART( USART_TX_INT_OFF & // Transmit Interrupt OFF
  17. USART_RX_INT_OFF & // Receive Interrupt ON
  18. USART_ASYNCH_MODE & // Asynchronous Mode
  19. USART_EIGHT_BIT & // 8-bit Transmit/Receive
  20. USART_CONT_RX & // Continuous Reception
  21. USART_BRGH_HIGH, // High Baud Rate
  22. (64E6 / 9600 / 16 - 1) // Baud Rate 9600
  23. );
  24. //http://www.microchip.com/forums/FindPost/836738
  25. }
  26.  
  27. void xportEnable(void){
  28. LDO_SHDN = true;
  29. XRESET = true;
  30. }
  31.  
  32. void xportSend(char data){
  33. Write2USART(data);
  34. }
  35. char xportReceive(void){
  36. return Read2USART();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement