<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Algorithm clarification</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/39429/algorithm-clarification</link><description> 
I am writing code to calculate the baud rate registers for UART1.
There is a flow chart on page 336 of the manual that I am using as a
guide. There is a block that says: 

 
int(PCLK / (16 * BR * FREST) 

 
What do they mean by int? Does that mean convert</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Algorithm clarification</title><link>https://community.arm.com/thread/66982?ContentTypeID=1</link><pubDate>Sat, 08 Oct 2011 02:46:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:befeca0e-3826-4df7-82be-20ba22713c29</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;page 336 of the manual&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;What&lt;/b&gt; manual? And what version/issue/release of that
manual?&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;What do they mean by int?&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Who is &amp;quot;&lt;b&gt;they&lt;/b&gt;&amp;quot;? Why don&amp;#39;t you ask &amp;quot;&lt;b&gt;them&lt;/b&gt;&amp;quot;?&lt;/p&gt;

&lt;p&gt;
Since the expression is a division, its result is likely to have a
fractional part.&lt;/p&gt;

&lt;p&gt;
Putting &lt;b&gt;int(...)&lt;/b&gt; like that is a pretty conventional way to
say, &amp;quot;the integer part of ...&amp;quot;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Algorithm clarification</title><link>https://community.arm.com/thread/66981?ContentTypeID=1</link><pubDate>Sat, 08 Oct 2011 02:43:25 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c1b01d19-cb85-4a98-8a80-cc73f9f2273b</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
&amp;quot;the manual&amp;quot; - don&amp;#39;t you think you should tell us what &amp;quot;the
manual&amp;quot; is? You haven&amp;#39;t even told us what processor you have.&lt;/p&gt;

&lt;p&gt;
&amp;quot;on page 336&amp;quot; - even if we do know what processor you are using,
we would still not know which revision of &amp;quot;the manual&amp;quot; you are
using.&lt;/p&gt;

&lt;p&gt;
There are no type casting in the manual. But the manual do tell
you to use the integer part of the equation presented. Most probably,
the manual suggests that you should truncate the result of the
division - especially if the processor also have a fractional
baudrate divisor register for more exact baudrate generation.&lt;/p&gt;

&lt;p&gt;
If the processor do not have a fractional baudrate divider, then
it is meaningful to perform proper rounding to use the closest
value.&lt;/p&gt;

&lt;p&gt;
No, I can not see why you should represent any values as doubles -
no microcontroller I have seen has a baudrate generator that expects
any floating point values. They always take an integer baudrate
divisor. And an optional fractional part, normally expressed as a
quotient of two integers (but potentially stored in the same
register)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>