Defined function for setting the baud during runtime.
This commit is contained in:
parent
6b73f1e513
commit
16492796be
49
avr_usart.c
49
avr_usart.c
|
@ -113,6 +113,55 @@ unsigned char rx_usart0(void) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Inupt: None
|
||||
* Output: None
|
||||
* Description:
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Inupt: None
|
||||
* Output: None
|
||||
* Description:
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Inupt: None
|
||||
* Output: None
|
||||
* Description:
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Inupt: None
|
||||
* Output: None
|
||||
* Description:
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Inupt: BUAD RATE as uint8_t
|
||||
* Output: None
|
||||
* Description: Sets the baud rate of the serial usart0
|
||||
* VALUES @ 1Mhz:
|
||||
* 207 --> 300bps
|
||||
* 103 --> 600bps
|
||||
* 51 --> 1200bps
|
||||
* 25 --> 2400bps
|
||||
* 12 --> 4800bps
|
||||
* 6 --> 9600bps !!! 7% error rate
|
||||
*/
|
||||
|
||||
void serial0_set_baud(uint8_t buad) {
|
||||
UBRR0H |= (uint8_t) (baud>>8);
|
||||
UBRR0L |= (uint8_t) baud;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Input: None
|
||||
* Output: None
|
||||
|
|
Loading…
Reference in New Issue