HSERSETUP 10400 baud Rate?

skaako

New Member
Hi, in the commands manual i found this for the HSERSETUP command

Advanced Technical Information:
Users familiar with assembler code programming may choose to create their own
‘baud’ rate settings. ‘baud’ must be a word value, and can be calculated from the
PIC microcontroller datasheet equations when SYNC=0, BRGH = 1 and BRG16 =
1. It is not possible to change these settings.

The project i am working on requires communications at a 10400 baud rate. I am not that familiar with assembly programming though. How would i go about setting this up?

Thanks
 

Technical

Technical Support
Staff member
From the PIC16F886 datasheet (www.microchip.com) the formula is

Desired baud rate = Fosc / (4 (n + 1) )

So n = (( Fosc / baud rate ) / 4 ) - 1

So at 4MHz n = ((4 000 000 / 10400) / 4 ) - 1 = 95 (rounded)

Working the other way, the exact actual baud rate at 95 will be

4000 000 / (4 (95+1)) = 10416, which is good enough!


So the command is

hsersetup 95,mode
 
Top