Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
All explained in the datasheet - it simply gives you more options of different baud rates at different clock speeds. Often using one specific option, for your specific case, producing a more accurate speed if you choose the correct option.Hi,
When setting the BAUD rate on a PIC, one of the settings is BRGH, the H stans for High.
what I want to know is, what is high and what is low?
In other words when is BRGH used?
Camerart
Hi N,All explained in the datasheet - it simply gives you more options of different baud rates at different clock speeds. Often using one specific option, for your specific case, producing a more accurate speed if you choose the correct option.
The datasheets usually have a table of example values, which show the percentage accuracy using each option at various speeds. The tables also show some speeds aren't available at all, if you choose the wrong option.
Generally, if you're looking for 9600 baud, you can use either, as it's likely to in the range of both, but one will be more accurate.
From the datasheet table for the 16F1827 it shows that with a 20MHz clock and BRGH as 0, 9600 baud is -1.36%, but with BRGH as 1, it's 0.16% accurate. With a 20MHz clock, and BRGH as 1, the lowest standard baud possible is 9600 baud, or 1200 baud with BRGH = 0.
Table 25.5 on page 301 of the 16F1827 datasheet dated 01/05/10
Hi I,Basically baud = fosc / 16* sprg or fosc / 64 *sprg
There is also a sprgh for the smallest speeds..
When Eric said on AAC Vlad gets 0.04% with a 20Mhz... I didn't believe him as I can only get 0.16%
Considering that's what MicroChip say, I'm with youBasically baud = fosc / 16* sprg or fosc / 64 *sprg
There is also a sprgh for the smallest speeds..
When Eric said on AAC Vlad gets 0.04% with a 20Mhz... I didn't believe him as I can only get 0.16%
Hi I and N,Considering that's what MicroChip say, I'm with you
However, if you use BRG16 = 1, then you can get 0.01% and 0.03% on a limited number of low speed baud rates - 300, 1200 and 2400. Or with BRGH = 1 and BRG16 =1, even 0% on some, and 0.03% on 9600.
Not that all this matters of course, the whole point of asynchronous connection is that it doesn't need to be perfectly accurate, as it re-syncs every ten bits. The MIcroChip table offers values as 'poor' as 3.55% out.
Hi J,With 32MHz clock I get 38461 Baud with Hseropen 38400.
Error about 0.16%
Hi F,Do you have the clock (crystal) frequency specified correctly?
As I haven't been able to set the BAUD rate to receive anything other than 38400 BAUD, I' wonder if it's only the TX that gets set?
Hi R,How are you changing GPS baud rate?
If you don't reconfigure that first, the PIC can never communicate with it!
eg. If the GPS is set for 38,400 then that's the only speed the PIC can use, for communications to work.
Hi I,Remember! Nigel said it a couple of posts back.. 0.16% is fine as only 10 bits are read. The only thing I can say now is! Noise! It's working "kinda" so the Baud must be near enough. The Tx pin on the 4431 will only be used once a packet arrives, However!! If the SPI is being clocked by the 46k22 ( I think that's the main one ) then I would be looking at the PORTC pins, SPI is on PORTC as well !
I'm pretty sure Vlad "bit bangs" the SPI unless you bypassed that.
I Know that.... BUT!!!!!!! in your code you open the Hardware uart... that pin will still be connected to the USART.. once the SPI starts you may ( may! because I can't tell from here) causing a conflict as is is getting a 5v input from the other chip.Hi I,
The TX pin on the 4431 is not used for TX, but for an SS/CS input.
The SPI is clocked by the MASTER 46K20.
The SPI is set to PORTD.
I tried Vlads HSEROPEN 9600 and seting the BITS as #5.
C