Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] how to get 300bd with 20 mhz osc

Status
Not open for further replies.

adnan_merter

Full Member level 3
Full Member level 3
Joined
Jan 23, 2008
Messages
160
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Location
The most beautiful city of the world
Activity points
2,526
hi,

i am trying to make comm. board which has got 300-19200bd freq. range, but i also need speed, i mean this board has to do some math. functions while receiving some messages from another device via rs232

so far i achieved to get 300 bd with 4mhz osc but it is not enough, is there any way to get 300 bd with higher osc freq.

i am using pic16f877, sould i change my microcontroller?

thanks.
 

The similar PIC18 has a full 16bit BaudRateRegister I have just found out, to accomodate even longer bit-periods for faster clocking... Spookily similar in pinout and such, I'd try one, and am about to funnily enough, as the "new" processor in my (formerly 16f887) PWM controller!

Cool, If you want BRG settings for 9600 on a 32Mhz 18(L)F4685 let me know!
NEal
 

hi,

i am trying to make comm. board which has got 300-19200bd freq. range, but i also need speed, i mean this board has to do some math. functions while receiving some messages from another device via rs232

so far i achieved to get 300 bd with 4mhz osc but it is not enough, is there any way to get 300 bd with higher osc freq.

i am using pic16f877, sould i change my microcontroller?

thanks.

Hi,

No, you do not need to change your pic.

If you look at the 877 datasheet USART section it shows all the baud rates v crystal frequency.
4 mhz will readily do 9600, I have a pic data logging to this pc all the time using just that.

You will see the choice of crystal / speed also gives an error rate, that means the accuracy of the timing signals its generates, not actual errors of data tx/rx.

For 19200 4 mhz may do, try some tests, but perhaps a 16mhz crystal might be the best choice for a fast processing and fast, accurate baud rates.

What language are you programming in ?
 

It wont go down to 300 though... If you can ditch 300 fair enough but the BRG isn't big enough and there's a base that BRGH brings down, but only A bit... I love my 16F887's, trust me, but don't worry about moving up or down the PIC ladder, I've got a 12f675. 16f88's, 16f723's, 877As, 887's, but also PIC18LF's (useful for the 3.6v jump!), PIC24FJ64GA(n)02's, PIC32MX's, and all very similar prices and pinouts except the voltage level. If you use an input capture channel or interupt-on-change rs232 is ~easy enough to bitbang using timer-capture...

If you can move the spec "up" from 300 you'd be easy enough sorted.... I've a 16Mhz 16f887 I can give you the BRGs from or take them from the book. If you know the BRG at 4Mhz, then double it running at 8, or quad for 16Mhz, if you've enough bits left!!

Cool,
NEAL
(We love the Whole world!)

---------- Post added at 21:57 ---------- Previous post was at 21:49 ----------

The BRG is the timebase counter for the TTL232, so if it couts to 255 at low speed the "datasheet says" 1.2kbaud is the lowest period, even with the x16 of the BRGH... 9600 is a period of 31, (32 * (Fosc/(4*16=64))/256) = (1/9600),

Another chip'll do it, but you'll work it out best from whats around
Cool matey
NEAL
 

You might be able to use synchronous mode. It's basically the same as using the 'normal' asynchronous mode but the baud clock is provided externally. If you have it free, loop the output from a timer back into the external serial clock input.

Brian.
 

The loopthrough-in-synchronous mode puts the RX and TX on the same pins, seemingly cool for 1 way comms if thats ok, interesting idea.!
NEAL
 

hello


for so low spped as 300 bauds,you can desactive UART interrupt,
if your RB0 pin is free, you can connect RC7 (RX) to RB0 to detect incomming data by RB0 interruption ,
once in RB0 interupt treatment, get the charactere by pooling RC7 , by using bit tempo (Nb of machine cycles)
see post #4
and for transmit on RC6 TX, use only software UART.
so hardware is the same for every speed.(except RB0 use)
and just commute UART Hardware or UART SOFTWARE .
 

It does seem (possible but) a lot of code where a PIC18LF'll do it for similar price, size, pinout etc, and the massive >1k ram of memory (compared to the 16F887 384bytes/ram!) is always of use. The compiler is free, toolset is the same as the 16F, etc.. I normally hate to say it (I've many 16F88x's in *current* brilliant uses!) but maybe a newer processor might save *hours* of work and save possible errant reception... TTL232 has been handled by chip makers for *years*, and for reliability and more fun I'd at least "have a play" with the 18F pic... PIC18 and later are slightly different to the 8bit where there is "LAT"'s" (used for output-port (PORT is just input), so LATB++; works, saving codespace and ram too)...

You can use an 18F pic in place of a 16F887, but let me know!
NEAL :)
XD
 

thanks fellows,

i read your replies and started to search on the net, and finally it will be a total long shot to be using 16f877 and configure it to 300bd

i decided to buy a new 18f25j11, it is cost effective and fulfilling the comm. requirements. Now i should redesign my circuit for new pin diagrams

thanks a lot
 

Thank you for brining it up Adnan! An interesting discussion, I am not a "Get a better chip" person normally, but appreciate all the points discussed, many thanks!!

We love the whole world :)
Neal
 

Thank you for brining it up Adnan! An interesting discussion, I am not a "Get a better chip" person normally, but appreciate all the points discussed, many thanks!!

Hi,

Perhaps you can enlighten me as to how it helps adnan_merter ?

Looking at the Usart sections for the 877a and 25J11 datasheet the only real difference seems to be that the 25j11 can do 40meg instead of 20mg of the 877.
At 300baud he still has the same problem - yes ?

Also dropping from a 5v to a 3v3 chip can cause more problems that it cures when sending data out to other 5v devices .
Also it has limited output current on many i/o pins
 
DId you look in the same datasheet for "16 bit baud register"? Solves everything as far as I can see, a well know solution too....
NEAL

---------- Post added at 18:06 ---------- Previous post was at 18:00 ----------

Basically, this bit of the datasheet explains all


[datasheetquote]
The BRG16 bit must be set to
use both SPBRG1 and SPBRGH1 as a 16-bit counter.
This allows the user to verify that no carry occurred for
8-bit modes by checking for 00h in the SPBRGHx
register.
Refer to Table 20-4 for counter clock rates to the
[/datasheetquote]
Neal
 

Hi,

Thanks Neal, missed that bit when I looked at the Datasheet, been one of those days having to send a bad workman on his way.

It does beg the question who is still using 300 baud, thought teletypes went out last century..
 
Yeah, no problem mate, I actually only know because it has come up in the last week coincidentally! I have a MicroChip RF module setup that took me while to get the comm port talking, all the "elements" of this post, 3.3v etc, qutite fun really!! The one thing I *always* struggle with is the baud rate! Luckily after years of it I know a way to work out the value, by setting the BRG in code, sending the BRG value out the serial port as text, wait a short bit, increment BRG, and make it do it again.... Eventually you get back to a screen with values on it, which are the ones that must be right!

I must admit, if the PIC18FJ is 3.3v I'd have gone for the 5.5v PIC18LF (given a choice, but I'd work around anything!), the 18LF4865 seems almost a direct replacement for the 16F88n... I've an 18F4685 in the RF circuit, not realising the MRF24J modules were 3v, but it works fine running stuff at both levels, even combined with the 5v TTL serial modules and 5v pullups to the serial ports on the PIC...

Cool mate, always fun (I hope! :))
NEAL

---------- Post added at 00:43 ---------- Previous post was at 00:40 ----------

300baud might be how the 1st messages after nuclear-judegement-day come through, over SW radio even (or over copper cables!), nicely "acoustic coupler" modem friendly, yeah lets keep it eh!
NEAL
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top