View previous topic :: View next topic |
Author |
Message |
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
maximum baud rate with internal RC oscillator |
Posted: Mon May 07, 2007 3:07 pm |
|
|
Quick question. I’m running an 18LF4320 from an internal RC oscillator. I’ve never used internal RC before. From what I know, RC is less accurate than Crystal. What’s the highest reliable baud rate that can be used for serial communication with PC (true RS-232 with a MAX3221 driver)
When PIC is transmitting 9600 baud, the PC receiving about 30% garbage. Either 9600 is too fast, or I’m doing something wrong. I’m going to scan through the standard baud rates until I find something acceptable, but I’d like to tap into the tribal knowledge too.
The PIC will be working well within the consumer range of temperatures. _________________ Read the label, before opening a can of worms. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Mon May 07, 2007 4:26 pm |
|
|
It is not just a matter of speed. It is a matter of timing uncertainty. If your clock is 5% off then by the end of a Start bit, 8 data bits, and a Stop bit you are half a bit off regardless of what baud rate you are using.
If this is a home project you can try fudging the baud rate. If 9600 almost works then try 9600 + 2% = 9792 baud or 9600 - 2% = 9408 baud and see which works better. Beware this may change with voltage, temperature, or a different chip. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Tue May 08, 2007 1:14 am |
|
|
The error in baud rate is only 0.6%. Dithering the baud rate by +/- 2% didn't have any positive effect. There should be something else wrong. For example, the XMIT pin stays high, when the data is not being transmitted. I think it should stay low. The output isn't inverted:
Code: | #use rs232(baud=38400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9,stream=pcrs232) |
_________________ Read the label, before opening a can of worms. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue May 08, 2007 1:28 am |
|
|
Why is bits set = 9 ? |
|
|
grasspuddle
Joined: 15 Jun 2006 Posts: 66
|
|
Posted: Tue May 08, 2007 9:21 am |
|
|
doesn't MAX 232 chips set tx/rx high when not in use? |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Tue May 08, 2007 10:40 am |
|
|
PCM wrote: | Why is bits set = 9 ? |
9 comes from the wizzard. I assumed that it's data_bits+stop_bits Changed to 8 - it works now.
grasspuddle wrote: | doesn't MAX 232 chips set tx/rx high when not in use? |
I have disconnected MAX3221 - the line remained high. There's no pull-up resistor either. _________________ Read the label, before opening a can of worms. |
|
|
|