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 the floating point result to an integer by casting? Please clarify.
I know the table part means find the closest value to the calculated decimal result in the lookup table. I am representing those values as constant ints and doubles.
"the manual" - don't you think you should tell us what "the manual" is? You haven't even told us what processor you have.
"on page 336" - even if we do know what processor you are using, we would still not know which revision of "the manual" you are using.
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.
If the processor do not have a fractional baudrate divider, then it is meaningful to perform proper rounding to use the closest value.
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)