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

In summary, the conversation discusses the conversion of a baud rate to the HEX contents of DLL and DLM in a PC16550D device. It is mentioned that N = DLL + DLM and the maximum value for DLL or DLM is 255. The conversation suggests looking for a built-in divider or shift in the datasheet to determine the correct values. Additionally, it is recommended to read the whole datasheet to gain a better understanding of the device's operational approach.
  • #1
Stu80
8
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

  • pc16550d.pdf
    1 MB · Views: 433
Physics news on Phys.org
  • #2
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:
  • #3
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
  • #4
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

1. How do I calculate the UART DLL and DLM contents from a given baud rate and clock frequency?

To calculate the UART DLL and DLM contents, you will need to use the formula: DLL = (Clock frequency/(16 x Baud rate)) and DLM = (DLL/256). This will give you the values needed to set the baud rate for your UART communication.

2. What is the purpose of calculating the UART DLL and DLM contents?

The UART DLL and DLM contents determine the baud rate of your UART communication, which is essential for ensuring accurate data transmission between devices. By calculating these values, you can configure your UART to communicate at the desired baud rate.

3. How does the clock frequency affect the UART DLL and DLM contents?

The clock frequency is directly proportional to the UART DLL and DLM contents. This means that as the clock frequency increases, the DLL and DLM values will decrease, resulting in a higher baud rate. Similarly, a lower clock frequency will result in higher DLL and DLM values and a lower baud rate.

4. Can I use the same formula to calculate UART DLL and DLM contents for different baud rates and clock frequencies?

Yes, the formula for calculating UART DLL and DLM contents can be used for any baud rate and clock frequency combination. However, keep in mind that the values may need to be rounded to the nearest integer to ensure accurate communication.

5. Are there any other factors that can affect the UART DLL and DLM contents?

Yes, in addition to the baud rate and clock frequency, other factors such as the UART's internal clock or any external clock sources can also affect the DLL and DLM values. It is essential to consider all these factors when calculating the DLL and DLM contents for your UART communication.

Similar threads

  • Special and General Relativity
3
Replies
95
Views
4K
Replies
9
Views
1K
  • Advanced Physics Homework Help
Replies
11
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Other Physics Topics
Replies
1
Views
1K
Replies
131
Views
4K
Replies
53
Views
35K
  • Introductory Physics Homework Help
Replies
5
Views
3K
Replies
3
Views
1K
  • Advanced Physics Homework Help
Replies
1
Views
2K
Back
Top