|
px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
|
How to configure and use a UART in a polled fashion.
File(s):
The UART is configured to 115200 BAUD, 8 Data Bits, No Parity and 1 Stop Bit. The string "UART\r\n" is sent upon start up. Thereafter all received characters are echoed back to the sender.
The clock rate of the AVR is defined in "px_board.h" with the macro F_CPU. It is a good programming practice to precalculate values at compile time, instead of using "magic values". For example, the value to use for the UBBR register is calculated with the following macro:
instead of using a hard coded value: