123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- #ifndef __USART_H__
- #define __USART_H__
- #pragma library io
- #define RAM_SCLS __data
- #define USART_TX_INT_ON 0xff
- #define USART_TX_INT_OFF 0x7f
- #define USART_RX_INT_ON 0xff
- #define USART_RX_INT_OFF 0xbf
- #define USART_BRGH_HIGH 0xff
- #define USART_BRGH_LOW 0xef
- #define USART_CONT_RX 0xff
- #define USART_SINGLE_RX 0xf7
- #define USART_SYNC_MASTER 0xff
- #define USART_SYNC_SLAVE 0xfb
- #define USART_NINE_BIT 0xff
- #define USART_EIGHT_BIT 0xfd
- #define USART_SYNCH_MODE 0xff
- #define USART_ASYNCH_MODE 0xfe
- #include "pic18fam.h"
- #if (__SDCC_USART_STYLE == 0)
- #warning The target device is not supported by the SDCC PIC16 USART library.
- #endif
- #if (__SDCC_USART_STYLE == 1822200) || \
- (__SDCC_USART_STYLE == 1865200)
- #define __SDCC_NO_SPBRGH 1
- #endif
- #if __SDCC_NO_SPBRGH
- typedef unsigned char sdcc_spbrg_t;
- #else
- typedef unsigned int sdcc_spbrg_t;
- #endif
- union USART
- {
- unsigned char val;
- struct
- {
- unsigned RX_NINE:1;
- unsigned TX_NINE:1;
- unsigned FRAME_ERROR:1;
- unsigned OVERRUN_ERROR:1;
- unsigned fill:4;
- };
- };
- void usart_open (unsigned char config, sdcc_spbrg_t spbrg) __wparam;
- void usart_close (void);
- unsigned char usart_busy (void) __naked;
- unsigned char usart_drdy (void) __naked;
- unsigned char usart_getc (void);
- void usart_gets (RAM_SCLS char * buffer, unsigned char len);
- void usart_putc (unsigned char data) __wparam __naked;
- void usart_puts (char * data);
- void usart_baud (sdcc_spbrg_t baudconfig) __wparam;
- #endif
|