diff options
author | Camil Staps | 2017-01-31 23:15:28 +0100 |
---|---|---|
committer | Camil Staps | 2017-01-31 23:15:28 +0100 |
commit | 631204a1feffa8cf3795060370b14dfb9f53f533 (patch) | |
tree | 001d32e0157127607f7c088881f098c2eca841a1 /uart.c |
Diffstat (limited to 'uart.c')
-rw-r--r-- | uart.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -0,0 +1,21 @@ +#include <xc.h> + +#include "uart.h" + +void uart_init(void) { + BAUDCON = 0x08; + SPBRGH = 0; +#ifdef P18F27K40 + SPBRGL = 138; +#endif +#ifdef P16F1778 + SPBRGL = 68; +#endif + TXSTA = 0x24; + RCSTA = 0x90; +} + +void uart_putch(unsigned char data) { + while (!TXIF) continue; + TXREG = data; +} |