/*******************************************************************/ // Defines /*******************************************************************/ //******* usart_init // (FOSC/(4 x Baud rate)) -1 BRGH=1 BRG16=1 // (FOSC/(16 x Baud rate)) -1 (BRGH=1 BRG16=0) or (BRGH=0 BRG16=1) - High speed // (FOSC/(64 x Baud rate)) -1 BRGH=0 BRG16=0 - Low speed //******* usart_init_auto // BRG16=0 BRGH=0 => FOSC/512 // BRG16=0 BRGH=1 => FOSC/128 // BRG16=1 BRGH=0 => FOSC/128 // BRG16=1 BRGH=1 => FOSC/32 #define BAUD_RATE 0x0196 //0x0065 // 4800 #define BAUD_BRGH 1 #define BAUD_BRG16 1 #define TX_LED portb.4 #define RX_LED portb.4 /*******************************************************************/ // Functions /*******************************************************************/ void usart_init(void); void usart_init_auto(void); void usart_putc(unsigned char data); unsigned char usart_getc(void); void usart_gets(unsigned char *destination); void usart_puts(unsigned char *source); void usart_putsln(unsigned char *source); void usart_put_newline(void); void usart_waitfor(unsigned char c); void usart_put_baoud(void);