CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC18F Software UART Max Baudrate

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
paulcamantigue



Joined: 10 May 2013
Posts: 1

View user's profile Send private message

PIC18F Software UART Max Baudrate
PostPosted: Fri May 10, 2013 10:37 am     Reply with quote

Hello all.

I currently have firmware in the PIC18F2580 utilizing a software UART with a baud of 10400 using the internal oscillator at 8 MHz.

Is there any sort of calculation or would any of you know if I'm able to bump the baud rate of the software UART to 125000 using the internal clock at 8 MHz? Would I have to bump it up to 16? Or does simply changing these values require me to also change some of the software?

This is what I have for settings:
Code:

#use delay(clock = 8000000, restart_wdt) // 8 Mhz

// Oscillator Configuration Pin (PLL Enable Pin)
#byte OSCTUNE = 0xF9B
#bit PLLEN = OSCTUNE.6

#use rs232(baud = 10400, xmit = PIN_C2, rcv = PIN_C1, stream = SOFTWARE_STREAM) // software UART


I know that the max baud of the hardware UART is 115200 but I'm wondering if the software UART at 8MHz or 16MHz can be bumped even higher.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 10, 2013 10:49 am     Reply with quote

Quote:

would any of you know if I'm able to bump the baud rate of the software
UART to 125000 using the internal clock at 8 MHz?

The compiler will give an error message if it can't do it.
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri May 10, 2013 11:52 am     Reply with quote

PCM P is right again...
but..

if using the internal Oscillator, be careful about 'stability issues'. while you might get the speed it might not be accurate or stable to waht's on the other end.Serial communications should be <3% so really stick a crystal in ! Small changes in temperature can easily shift the internal clock 'out of spec'.
Spending an extra 50 cents now is worth it compared to the head banging and saying 'I should have' ,couple months from now, when you're tracking down a 'sometimes-it-doesn't work' problem....


hth
jay
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sat May 11, 2013 10:24 am     Reply with quote

as a "rule of thumb" i have found the maximum safe baud to use

(errors from chip 2 chip variation && over the temperature range)

with an internal pic oscillator is Fosc/64


for an 8mhz clock , Fosc=2mhz
then max safe baud is 38400 or less

my experience and 2 cents worth
Tom Jetland



Joined: 23 Jun 2011
Posts: 31
Location: UK

View user's profile Send private message

PostPosted: Thu May 23, 2013 8:00 am     Reply with quote

For interest only, I've successfully long term tested up to 3mbps (3 megabaud), between two 18f4620 pics using their internal UARTs over 250metres of cable (using a proprietary driver system).

External 10MHz crystal using 4xPLL.

Tom

EDIT: OK, just actually read your subject and realised you're using a software based handler, ignore my post... I need new glasses Rolling Eyes

I guess your hardware pins are already being used? That's the reason I went to the 46k22 pics, 2 hardware UARTs - yay!!! Very Happy
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group