; modified by Radu Constantinescu - eliminate calls in order to save stack space ; UART routines with TX and RX buffers By Tony Kübek 2000-06-22 free for use ; handy ASCII character table STX EQU 0x02 ; stx ETX EQU 0x03 ; etx BEL EQU 0x07 ; bell BS EQU 0x08 ; backspace TAB EQU 0x09 ; horizontal tab LF EQU 0x0A ; line feed FF EQU 0x0C ; form feed CR EQU 0x0D ; carriage return XON EQU 0x11 ; transmit on XOFF EQU 0x13 ; transmit off EOF EQU 0x1A ; end of file ESC EQU 0x1B ; escape SP EQU 0x20 ; space ; buffers for serial communication RX_BUFFER_SIZE EQU 32 ; serial receive buffer allocation ( best when power of 2 ) TX_BUFFER_SIZE EQU 32 ; serial transmit buffer allocation ; Baud rate constants from (((10*XTAL_FREQ/(16*BAUD))+5)/10)-1 ; note these calulations uses BRGH = 1 ( high speed mode ) ; for BRGH = 0 use the formula: (((10*XTAL_FREQ/(64*BAUD))+5)/10)-1 ; NOTE Rather use the calculations further down below instead ! ;BAUD_9600 EQU (((10*XTAL_FREQ/(16*9600))+5)/10)-1 ;BAUD_19200 EQU (((10*XTAL_FREQ/(16*19200))+5)/10)-1 ;BAUD_38400 EQU (((10*XTAL_FREQ/(16*38400))+5)/10)-1 ;BAUD_57600 EQU (((10*XTAL_FREQ/(16*57600))+5)/10)-1 ;BAUD_115200 EQU (((10*XTAL_FREQ/(16*115200))+5)/10)-1 ; caulculates baudrate when BRGH = 1, adjust for rounding errors #define CALC_HIGH_BAUD(BaudRate) (((10*XTAL_FREQ/(16*BaudRate))+5)/10)-1 ; caulculates baudrate when BRGH = 0, adjust for rounding errors #define CALC_LOW_BAUD(BaudRate) (((10*XTAL_FREQ/(64*BaudRate))+5)/10)-1