Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/29/02 17:47
Read: times


 
#28188 - question on computation and serial I/O
Two questions :

1.
In order to compute the baudrate, there is the following formula :

TH1 = (unsigned char) (256 - (clock / (16 * 12 * baudrate))); when SMOD=1

On website ressources, I've found an uart sample software where there is nearly the same formula :

TH1 = (unsigned char) (256 - (clock / (16L * 12L * baudrate)));

The only difference is the 16L instead 16 and 12L instead 12. What are the 'L' utility ?

2.
I've checked this formula and confirmed with the Keil website tool for baudrate computation and the formula is OK

I've a 20MHz clock and for 1200 bauds, I've TH1=169 (1197 bauds)

In order to test, I've wrote this :
while (1)
{
UART_Putchar("A");
}

It's should send a "A" character continuously on the terminal

With my first formula, nothing happens and with the second including the L, some irrelevants characters are continuously displayed...

Let me know your feelings...

Stephane



List of 4 messages in thread
TopicAuthorDate
question on computation and serial I/O            01/01/70 00:00      
RE: question on computation and serial I/O            01/01/70 00:00      
RE: question on computation and serial I/O            01/01/70 00:00      
RE: question on computation and serial I/O            01/01/70 00:00      

Back to Subject List