diff options
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; +} |
