RE: why devide by 32 while calcluting baudrate in 8051
The important thing is that a UART needs a clock frequency that is
several times faster than the baudrate.
This allows the UART to support a mismatch in baudrate between
sender and receiver.
The UART samples again and again until it detects the start of the
start bit. Then it keeps counting n clocks / bit until having taken
care of the stop bits.
While counting the clocks, the UART takes a couple of samples
within each bit window and uses a majority vote to determine if the
bit was a zero or a one, improving noise handling.
And by ignoring the start and end of each bit window, the UART can
handle that the bit window slowly glides forward or backward because
of smaller baudrate errors.
If looking generally at UARTs, it is common that the UART samples
16 times faster than the baudrate. Some may sample faster and a few
lower-quality UART may sample slower.