Microchip Technology
Welcome to www.microchip.com
Search: Click here to Search Microchip.com
Forums Home Register LoginLog Out Inbox Address Book My Subscription Member List Search My Profile FAQ
Revised SPBRG Calc...

Revised SPBRG Calc...

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Microcontroller Discussion Group] >> SCI/USART/EUSART >> Revised SPBRG Calc... Page: [1]
Login
Message << Older Topic   Newer Topic >>
Revised SPBRG Calc... - Feb. 14, 2005 9:30:42 PM   
K8LH
Experienced Hobbyist

 

Posts: 1545
Joined: Mar. 26, 2004
From: Michigan, USA
Status: offline
For those who may be interested, I have revised the Excel 2000 SPBRG Calculator spreadsheet to support the 16 bit SPBRG modes available on some newer devices, like the16F690 and 18F2620 (and others)...

8-bit SPBRG Solutions
Enter '0' (zero) in the BRG16 cell and enter '0' or '1' in the BRGH cell to produce standard 8 bit SPBRG solutions for our legacy UART PIC devices or 8-bit SPBRG compatible mode solutions for the newer 16-bit capable devices...

16-bit SPBRG Solutions
Enter '1' in the BRG16 cell and enter '0' or '1' in the BRGH cell to produce the new 16 bit SPBRG solutions... A 16-bit SPBRG solution cannot be used on legacy 8-bit SPBRG PIC devices...

You can also edit the "Display errors less than" cell, oscillator frequency cells, and any of the Baud Rate cells in the left most column...

I know, I know... You're supposed to use the formulas but I still find it easier to look at a much wider selection of baud rates and "plug in" different crystal frequencies and change BRGH modes to see the results at-a-glance...

You'll probably notice the precision of the new 16 bit SPBRG modes is awesome...

Regards, Mike



(288)

Attachment (1)

< Message edited by K8LH -- Feb. 23, 2007 2:25:05 PM >
Post #: 1
RE: Revised SPBRG Calc... - Feb. 15, 2005 3:32:41 AM   
Guest
Thanks for inserting the exact multiply crystal values... so that people will see that such things exist.
  Post #: 2
RE: Revised SPBRG Calc... - Feb. 15, 2005 6:53:03 AM   
FredH

 

Posts: 93
Joined: Nov. 12, 2003
Status: offline
Greetings Mike,


Here is my rendition. I have been using it over the last several years. I have been modifying it just about every time I use a PIC.

Attachment (1)

_____________________________

Best regards,
Fred

(in reply to Guest)
Post #: 3
RE: Revised SPBRG Calc... - Jan. 18, 2006 6:21:42 AM   
zalex

 

Posts: 702
Joined: Oct. 14, 2004
From: UK
Status: offline
What about the PIC18F4550, where the CPU frequency can be 48MHz ?

_____________________________

Alex
Post #: 4
RE: Revised SPBRG Calc... - Aug. 2, 2006 4:29:50 PM  1 votes
K8LH
Experienced Hobbyist

 

Posts: 1545
Joined: Mar. 26, 2004
From: Michigan, USA
Status: offline
Hi guys,

I've come up with a single file stand-alone SPBRG Calculator application to share (pictured below).  It's about 1-MByte in size.

Download here --> K8LH SPBRG Calculator v11.exe     (the attachment below is only the graphic)

Simply enter your oscillator frequency in the Fosc field, press <enter>, and toggle the BRGH and BRG16 radio buttons.  Only SPBRG solutions with less than 4% bit rate error are displayed.  The Code Generator portion of the program is not implemented at this time.

Regards, Mike



Attachment (1)

< Message edited by K8LH -- Oct. 21, 2006 5:32:36 AM >

(in reply to zalex)
Post #: 5
RE: Revised SPBRG Calc... - Aug. 2, 2006 4:39:16 PM   
potholer

 

Posts: 289
Joined: Feb. 13, 2005
Status: offline
How many downloads do you anticipate?
I have a fair amount of bandwidth on my current web-hosting bundle, the large majority of which I don't currently use. If you don't expect multiple thousands of downloads/month, email me.

< Message edited by potholer -- Aug. 2, 2006 4:55:47 PM >

(in reply to K8LH)
Post #: 6
RE: Revised SPBRG Calc... - Aug. 2, 2006 4:49:09 PM   
ric
5+ years with MCHP products


Posts: 12848
Joined: Nov. 7, 2003
From: Australia, Melbourne
Status: offline
You just beat me potholer.
I've also got plenty of spare bandwidth. buzz me if potholer's offer falls through

_____________________________

---—≡≡≡
(All users, please read the "forum guidelines" before posting a question.)

(in reply to potholer)
Post #: 7
RE: Revised SPBRG Calc... - Aug. 3, 2006 5:22:37 AM   
K8LH
Experienced Hobbyist

 

Posts: 1545
Joined: Mar. 26, 2004
From: Michigan, USA
Status: offline
Thank you both for your kind offer.  I've found space to host the file and have modified the post above with the link.  Please check it out.

Regards, Mike

(in reply to ric)
Post #: 8
RE: Revised SPBRG Calc... - Aug. 3, 2006 9:54:55 AM   
Guest
Very nice job on the program and sheet! I've linked to those from my site.

http://www.piclist.com/techref/microchip/spbrgcalc.asp may also be of use for 8 bit calculations.

Here is the source code for that page incase anyone wants to update it to also manage 16 bit calculations. I'll be happy to host the updated version for people who do not wish to work with M$ applications or who just need a quick calculation from the web.

[size=1]
[size=1]
for intSPBRG = 255 to 0 step -1
 dTemp1 = (intSPBRG+1.0) * 64.0
 debug dTemp1
 dBaud0 = fOSCILLATOR / dTemp1
 debug dBaud0
 intSPBRG0 = intWithin3Percent(dBaud0)

 dTemp1 = (intSPBRG+1.0) * 16.0
 dBaud1 = fOSCILLATOR / dTemp1
 intSPBRG1 = intWithin3Percent(dBaud1)
 if intSPBRG0>0 or intSPBRG1>0 then
   response.write "<TR>"
   response.write "<TD ALIGN='RIGHT'>" & intSPBRG & "</TD>"
   response.write "<TD>"
   if intSPBRG0>0 then
     PercentErr = (1-(int(dBaud0)/intSPBRG0))*100
     response.write FormatNumber(dBaud0,2)
     if abs(PercentErr) > 1.5 then response.write "<FONT color=#800000>"
     if abs(PercentErr) < 0.5 then response.write "<FONT color=#008000>"
     response.write " <SMALL>("&intSPBRG0&" "& FormatNumber(PercentErr,1) & "%)</SMALL>"
     if abs(PercentErr) > 1.5 or abs(PercentErr) < 0.5 then response.write "</FONT>"
     end if
   response.write "&nbsp;</TD>"
   response.write "<TD>"
   if intSPBRG1>0 then
     PercentErr = (1-(int(dBaud1)/intSPBRG1))*100
     response.write FormatNumber(dBaud1,2)
     if abs(PercentErr) > 1.5 then response.write "<FONT color=#800000>"
     if abs(PercentErr) < 0.5 then response.write "<FONT color=#008000>"
     response.write " <SMALL>("&intSPBRG1&" "& FormatNumber(PercentErr,1) & "%)</SMALL>"
     if abs(PercentErr) > 1.5 or abs(PercentErr) < 0.5 then response.write "</FONT>"
     end if
   response.write "&nbsp;</TD>"
   response.write "</TR>"
   end if
 next
[/size]
[/size]

(in reply to K8LH)
  Post #: 9
RE: Revised SPBRG Calc... - Aug. 3, 2006 6:00:21 PM   
Dredd
5+ years with MCHP products

 

Posts: 544
Joined: Nov. 7, 2003
From: Montreal, Canada
Status: offline
Its not related to the subject, But i just want to thank you (JamesNewton) for the magnificent job you do with your site. If you need some code related to pic, piclist is the site to go.

Just wanted to say thanks for the many times you're site got me out of troubles

(in reply to Guest)
Post #: 10
RE: Revised SPBRG Calc... - Mar. 31, 2008 6:43:58 AM  1 votes
xiaofan

 

Posts: 5331
Joined: Apr. 14, 2005
From: Singapore
Status: offline
Somehow the PC application (http://www.wowway.com/~mmclaren/K8LH%20SPBRG%20Calc%20v11.exe) does not run here.

Error Message pop-up:
Runtime Error: index: 0 is outside of collection bounds (see error.log for more information).

And I have to manually kill the process in Windows task manager.

Error.log:

Error log timestamp Monday 03/31/08 09:40:02 PM
Runtime error: index: 0 is outside of collection bounds
Error(Exception)>>defaultAction
Error(Exception)>>activateHandler: <anUndefinedObject>
Error(Exception)>>handle
Error(Exception)>>signal
Error class(Exception class)>>signal: <'index: 0 is outside ...'>
OrderedCollection(Object)>>error: <'index: 0 is outside ...'>
OrderedCollection(IndexedCollection)>>errorInBounds: <0>
OrderedCollection>>at: <0> put: <anOrderedCollection>
BasicOnDemandCompiler class>>readTknFile: <aMixedFileStream> callingProgram: <anUndefinedObject> commandLine: <''>
Basic class>>start
Message>>perform
NotificationManager>>empty
NotificationManager>>runPendingEvents
NotificationManager>>runEventLoop
Message>>perform
Message>>evaluate
Process>>safelyEvaluate: <aMessage>
Process>>evaluate: <aMessage>

_____________________________

Blog: http://mcuee.blogspot.com USB links: http://www.microchip.com/forums/tm.aspx?m=123533
No PMs for technical questions, use the forum!

(in reply to K8LH)
Post #: 11
RE: Revised SPBRG Calc... - Mar. 31, 2008 7:19:46 AM   
paulbergsman
5+ years with MCHP products

 

Posts: 1504
Joined: May 25, 2006
From: Merion Station, Penna.
Status: offline
quote:

ORIGINAL: K8LH

For those who may be interested, I have revised the Excel 2000 SPBRG Calculator spreadsheet to support the 16 bit SPBRG modes available on some newer devices, like the16F690 and 18F2620 (and others)...

Regards, Mike


VERY NICE!

(in reply to K8LH)
Post #: 12
RE: Revised SPBRG Calc... - Mar. 31, 2008 9:52:36 AM   
DarioG
5+ years with MCHP products

 

Posts: 23230
Joined: Feb. 25, 2006
From: Trana (TO), Italy
Status: offline
quote:

ORIGINAL: xiaofan

Somehow the PC application (http://www.wowway.com/~mmclaren/K8LH%20SPBRG%20Calc%20v11.exe) does not run here.



Hi Xiaofan, it's ok in here: Windows 2000 SP4...

I can just see (never used it before) that some Redraw inside the Window does not work correctly in some cases, and also when you change Clock Freq, you have to hit Return but it's not obvious.

_____________________________

Dario Greggio

(in reply to xiaofan)
Post #: 13
RE: Revised SPBRG Calc... - Apr. 3, 2008 5:11:43 AM   
xiaofan

 

Posts: 5331
Joined: Apr. 14, 2005
From: Singapore
Status: offline
http://www.mister-e.org/pages/utilitiespag.html

This seems to work and it has quite some other functions.

_____________________________

Blog: http://mcuee.blogspot.com USB links: http://www.microchip.com/forums/tm.aspx?m=123533
No PMs for technical questions, use the forum!

(in reply to DarioG)
Post #: 14
RE: Revised SPBRG Calc... - Apr. 4, 2008 2:21:50 AM   
DarioG
5+ years with MCHP products

 

Posts: 23230
Joined: Feb. 25, 2006
From: Trana (TO), Italy
Status: offline
Thank you Xiaofan.
As Olin once said, I don't usually use such tools but I'll store it... you never know!

_____________________________

Dario Greggio

(in reply to xiaofan)
Post #: 15
RE: Revised SPBRG Calc... - Apr. 7, 2008 3:36:34 PM   
magicrub
Professional 2-5 years with MCHP products

 

Posts: 64
Joined: May 16, 2007
From: Santa Cruz, Ca. USA
Status: offline
Other than backwards compatability reasons, why would I ever want to use an 8bit divider on an 18F chip?

Even if the 8 bit and 16bit give you zero error, why not just always use 16?

_____________________________

-Tom

(in reply to DarioG)
Post #: 16
RE: Revised SPBRG Calc... - Apr. 20, 2008 2:25:55 AM   
K8LH
Experienced Hobbyist

 

Posts: 1545
Joined: Mar. 26, 2004
From: Michigan, USA
Status: offline
Hi Tom,

Not all 18F' devices have the 16 bit SPBRG divider chain and only a few 16F' devices have it.

Regards, Mike

(in reply to magicrub)
Post #: 17
Page:   [1]
All Forums >> [Microcontroller Discussion Group] >> SCI/USART/EUSART >> Revised SPBRG Calc... Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


  Site Index  |  Legal Information  |  microchipDIRECT  |  Samples  |  Technical Support  |  Investor Information  |  Careers at Microchip  |  Contact Us  |  RSS Feeds ©2009 Microchip Technology Inc.  
  Shanghai ICP Recordal No.09049794  
Forum Software © ASPPlayground.NET Advanced Edition 2.5.5 Unicode

0.250