Content originally posted in LPCWare by cfb on Fri Sep 14 16:37:50 MST 2012
Quote: toby
I'm not sure if their sheet is wrong or if mine is wrong.
I've attached a copy of the source code, LPC1769 executable hex file and screenshot of a demonstration program [I]CalcBaudRate[/I] that we ship with our Astrobe for Cortex-M3 development system. You could use this to check your results. CalcBaudRate writes its output to a terminal emulator on your PC running at 38,400 Baud connected to UART0 of the LPC1769.
CalcBaudRate calculates and displays the [I]optimum[/I] values of the parameters for a range of crystal frequency and baud rate combinations.
The [I]Calculate[/I] function included in the example was designed to be efficient enough to be extracted and included in your application if you want to generate the values dynamically. It is less than 500 bytes in size and takes about 16ms to execute.
The source code was written using the 2011 revision of the Oberon Programming Language. It is less than 30 lines of code so it would be a fairly easy exercise to translate it to C or some other language if required.