Searching \ for '[PIC:] Baud Rate Generator' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'Baud Rate Generator'.

Exact match. Not showing close matches.
PICList Thread
'[PIC:] Baud Rate Generator'
2002\01\16@141031 by Harold M Hallikainen

picon face
       Looking at the datasheet for the PIC16F62x (page 73), it lists the async
serial port baud rate as Fosc/(16(x+1) where X is the SPBRG value (0 to
255), with BRGH=1. It APPEARS I should be able to make X=0 with Fosc=4MHz
and get 250 kbps. However, if we look on page 75 of the datasheet, it
lists 250kbps as NA with Fosc=4MHz.
       Which is correct?

Thanks!

Harold


FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/web/.

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2002\01\16@152235 by Thomas C. Sefranek

face picon face
Harold M Hallikainen wrote:

>        Looking at the datasheet for the PIC16F62x (page 73), it lists the async
>serial port baud rate as Fosc/(16(x+1) where X is the SPBRG value (0 to
>255), with BRGH=1. It APPEARS I should be able to make X=0 with Fosc=4MHz
>and get 250 kbps. However, if we look on page 75 of the datasheet, it
>lists 250kbps as NA with Fosc=4MHz.
>        Which is correct?
>
4 MHz /16 /2 = ???  X must be 1 or more!

{Quote hidden}

--
 *
 |  __O    Thomas C. Sefranek  tcsspamKILLspamcmcorp.com
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 MHz

ARRL Instructor, Technical Specialist, VE Contact.
hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


2002\01\16@155334 by Harold M Hallikainen

picon face
On Wed, 16 Jan 2002 15:18:10 -0500 "Thomas C. Sefranek" <EraseMEtcsspam_OUTspamTakeThisOuTCMCORP.COM>
writes:
> Harold M Hallikainen wrote:
>
> >        Looking at the datasheet for the PIC16F62x (page 73), it
> lists the async
> >serial port baud rate as Fosc/(16(x+1) where X is the SPBRG value
> (0 to
> >255), with BRGH=1. It APPEARS I should be able to make X=0 with
> Fosc=4MHz
> >and get 250 kbps. However, if we look on page 75 of the datasheet,
> it
> >lists 250kbps as NA with Fosc=4MHz.
> >        Which is correct?
> >
> 4 MHz /16 /2 = ???  X must be 1 or more!
>

       Page 73 of the datasheet says "0 to 255". Also, page 75 shows an SPBRG
value of 0 giving a bit rate of 223.721 kbps with an oscillator frequency
of 3.579 MHz (BRGH = 1). So, does X have to be 1 or more?

Harold

FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/web/.

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamspam_OUTmitvma.mit.edu


2002\01\16@182423 by David Duffy

flavicon
face
At 09:48 AM 16/01/2002 -0800, you wrote:
>         Looking at the datasheet for the PIC16F62x (page 73), it lists
> the async
>serial port baud rate as Fosc/(16(x+1) where X is the SPBRG value (0 to
>255), with BRGH=1. It APPEARS I should be able to make X=0 with Fosc=4MHz
>and get 250 kbps. However, if we look on page 75 of the datasheet, it
>lists 250kbps as NA with Fosc=4MHz.
>         Which is correct?

I assume that this is for DMX ?  I put 20MHz 16F628's in my dimmer project
as I came to the conclusion that you need at least a 10MHz clock to do the
250Kbps data rate. I have not written the DMX code for it yet though. SPBRG
needs to be 4 at 20MHz and 20MHz/4MHz = 5 so you'd have to have 0.8 for
4MHz !  Maybe a value of 1 at 5MHz would work. (but not for a 4MHz part)
The 16F628-20/P is currently cheaper than the 16F628-04/P I've found.
Regards...

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestKILLspamspammitvma.mit.edu


2002\01\16@192639 by Harold M Hallikainen

picon face
On Thu, 17 Jan 2002 09:29:19 +1000 David Duffy
<KILLspampiclistKILLspamspamAUDIOVISUALDEVICES.COM.AU> writes:
> I assume that this is for DMX ?  I put 20MHz 16F628's in my dimmer
> project
> as I came to the conclusion that you need at least a 10MHz clock to
> do the
> 250Kbps data rate. I have not written the DMX code for it yet
> though. SPBRG
> needs to be 4 at 20MHz and 20MHz/4MHz = 5 so you'd have to have 0.8
> for
> 4MHz !  Maybe a value of 1 at 5MHz would work. (but not for a 4MHz
> part)
> The 16F628-20/P is currently cheaper than the 16F628-04/P I've
> found.

       Yes, it's DMX (actually, it's our DMX talk back). I've done bunches of
DMX stuff using a PIC at 16 MHz. However, here, I thought I'd use 4 MHz
since I should then be able to use any 16F627.
       The datasheets (for example, page 73 of the PIC16F62X datasheet) say the
bit rate is Fosc/(16(X+1)) if BRGH=1. Solving for X, we get
X=(Fosc/(16*BR))-1 . If Fosc=20MHz and BR=250e3, we get X=44 (not 5).
Dropping to 4 MHz, we get X=0.
       So, it seems that it would work. Some have said X has to be between 1
and 255 inclusive, but the datasheet says 0 and 255 inclusive. The
datasheet also shows several examples where X=0 (for example, 625 kpbs
with Fosc=10 MHz).
       So, the question remains, why does the datasheet show NA for 250 kbps at
4 MHz?
       I have since changed my resonator to 16 MHz and found other bugs in the
code. I imagine that if I change back to 4 MHz (now that the bugs are
removed), it will work... but I don't know if I want to make the effort.
Just trying to figure out why the datasheet says 250 kbps at 4 MHz is
"NA."  Looks like it should work...

Harold

FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/web/.

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2002\01\16@210340 by M. Adam Davis

flavicon
face
The tables (at least two of them, but not all) are wrong.  The
calculation is correct.

This has been a problem since they released the data sheets for the
'f87x parts, perhaps even earlier chips with UARTs.

Don't trust the tables.

-Adam

Harold M Hallikainen wrote:

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
TakeThisOuTpiclist-unsubscribe-requestEraseMEspamspam_OUTmitvma.mit.edu


2002\01\16@211855 by Bob Barr

flavicon
face
On Wed, 16 Jan 2002 16:21:53 -0800, Harold M Hallikainen wrote:

<snip>

{Quote hidden}

Well, the math sure works. It probably will work as you expect. My
presumption is that Microchip doesn't want to commit that all PICs
will reliably work at 4 MHz with a zero divider over all temps and Vdd
levels.

They may have characterized the circuit and found that, while it works
reliably up to 3.579 MHz with a zero divider (which they show), it may
get flakey above that. At nominal temps and Vdd levels, I wouldn't
think that it would be a problem to push it to 4 MHz. (Note: I
wouldn't do this in a commercial product. YMMV)

Regards, Bob

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspamTakeThisOuTmitvma.mit.edu


2002\01\17@070413 by Byron A Jeff

face picon face
On Wed, Jan 16, 2002 at 09:02:36PM -0500, M. Adam Davis wrote:
> The tables (at least two of them, but not all) are wrong.  The
> calculation is correct.
>
> This has been a problem since they released the data sheets for the
> 'f87x parts, perhaps even earlier chips with UARTs.
>
> Don't trust the tables.

I never have. For all things relating to the PIC USART I use Fr. Thomas
McGahee's highly annotated code the describes the operation of the USART,
including the formula for bit rate generation. It's an invaluable resource
for dealing with the USART and includes many 'gotchas' that have been learned
from hard experience. Check it out here:

http://mcgahee.freeservers.com

BAJ

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\17@073353 by Vasile Surducan

flavicon
face
On Thu, 17 Jan 2002, Byron A Jeff wrote:

> > Don't trust the tables.
>
> I never have. For all things relating to the PIC USART I use Fr. Thomas
> McGahee's highly annotated code the describes the operation of the USART,
> including the formula for bit rate generation. It's an invaluable resource
> for dealing with the USART and includes many 'gotchas' that have been learned
> from hard experience. Check it out here:
>
> http://mcgahee.freeservers.com
>
 Agree. However I don't found any diferences between standard formulas:

spbrg = (xtal[hz]/(baudrate[bps]*64))-1 for brgh=low
spbrg = (xtal[hz]/(baudrate[bps]*16))-1 for brgh=high

 and rounded formulas:

spbrg_value = (((d'10'*XTAL_FREQ/(d'16'*baudrate))+d'5')/d'10')-1
spbrg_value = (((d'10'*XTAL_FREQ/(d'64'*baudrate))+d'5')/d'10')-1

 the result is +/- 1 diference in spbrg value which means almost nothing,
my test shows that at many baud rates even with +/- 3 from computed spbrg
values does not affect asynchronous communications ( not applicable with
small spbrgh ) Of course the computed error must be smallest as possible.
So my question: do you found any situation when rounded formulas
must be applied ?

regards, Vasile

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\17@114808 by Harold M Hallikainen

picon face
I include the following lines in all my stuff with uarts

BitRate         equ     d'250000'; Run at 250 kbps
ProcessorClock  equ     d'16'   ; Run at16 MHz
BrgInit         equ     (ProcessorClock*d'62500'/BitRate)-1 ; Baud rate generator
init with BRGH high (16c74b and later)
; BrgInit               equ     (ProcessorClock*d'15625'/BitRate)-1 ; Baud rate generator
init with BRGH clear.

Let the assembler figure it out for you...

Harold


FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/web/.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\27@204235 by Josh Koffman

flavicon
face
Did you ever do more experimentation on this Harold?

Josh
--
A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete
fools.
       -Douglas Adams

Harold M Hallikainen wrote:
>
>         Looking at the datasheet for the PIC16F62x (page 73), it lists the async
> serial port baud rate as Fosc/(16(x+1) where X is the SPBRG value (0 to
> 255), with BRGH=1. It APPEARS I should be able to make X=0 with Fosc=4MHz
> and get 250 kbps. However, if we look on page 75 of the datasheet, it
> lists 250kbps as NA with Fosc=4MHz.
>         Which is correct?

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\28@123821 by Harold M Hallikainen
picon face
Nope, never did. I didn't want to rip up my prototype board by replacing
the resonator a few more times...  So, I'm leaving it at 16 MHz.  We buy
those resonators by the thousands anyway...

Harold

On Sun, 27 Jan 2002 20:34:17 -0500 Josh Koffman <listsjoshEraseMEspam.....3MTMP.COM>
writes:
{Quote hidden}

FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/web/.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...