Comp Sci Calculating UART DLL and DLM contents from Baud Rate and Clock Frequency

AI Thread Summary
To calculate the contents of DLL and DLM from a baud rate and clock frequency, the formula used is Baud Rate = Clock Frequency / (16 x N), where N equals DLL + DLM. When N is determined to be 576, it needs to be converted into HEX values for DLL and DLM, which both have a maximum value of 255. The discussion highlights the importance of understanding that the divisor is stored in a 16-bit binary format across two 8-bit latches. A recommendation is made to thoroughly read the datasheet for better comprehension of the device's operational approaches. The question regarding the conversion was ultimately resolved.
Stu80
Messages
8
Reaction score
3
Homework Statement
A PC16550D UART has a clock running at18.432 MHz and its
baud rate is set to 2000. Determine the HEX contents of its DLM and
DLL registers
Relevant Equations
Baud rate = Clock frequency/(16×N)
I understand that,

Baud Rate = Clock Frequency / (16 x N)

and that N = DLL + DLM

when I substitute the figures to get an answer for N to be 576, how do I then convert this into the HEX contents of DLL and DLM, especially considering the maximum value for DLL or DLM is 255?

I have uploaded the PC16550D datasheet for reference if needed.
 

Attachments

Physics news on Phys.org
Fun problem, and very practical. I do this sort of thing all the time at my work.

I didn't look at the datasheet, but look for a built-in divider or shift by a couple of bits. For example, in the USB standard, the requested Icc by a device being plugged in is a factor of 2 higher (in mA) than the hex value that is reported (requested current = 2x the configuration value), and the USB host knows that.
 
Last edited:
See paragraph 8.5.1 on pg. 17 of the datasheet, and immediately following, the last two columns of Table 1.

A clue is this sentence in paragraph 8.5.1:
Two 8-bit latches store the divisor in a 16-bit binary format.
These Divisor Latches must be loaded during initialization ...


There is more information a few pages later.

In fact, I recommend you read the whole datasheet, even the confusing parts. You will remember a few of the ideas the next time you use this or similar devices, and will gradually be able to put together a mental picture of their general operational approaches.

Cheers,
Tom
 
  • Like
Likes berkeman and Stu80
Thank you Tom, I had already read that specific paragraph but it hadn't clicked regarding the 16-bit divisor - I was wrongly reading them as 2 separate 8-bit latches.

Question answered!

Cheers
 
  • Like
Likes Tom.G and berkeman
Back
Top