PDA

View Full Version : max baudrate serout2 command



mat janssen
- 15th July 2004, 13:01
How far can I go with the serout2 (serin2) command ?
I use the pic16f628 with 20mHz xtal

My programm looks like

DEFINE SER2_BITS 8

serout2 pinout,32,[mydata]

SerIn2 PININ,32,50,BEGIN,[WAIT("$"),B1]

If I lower the 32, the baudrate becomes faster.
How fast can I go ?
is it possible to get 250 Kbaud ?

Thanks in advance.

Melanie
- 15th July 2004, 19:42
Why not try it with Hyperterminal on your PC... it has configurable options at 115200, 230400, 460800 and 921600 baud (at least the win-XP-Pro version goes that high).

mat janssen
- 15th July 2004, 20:08
Sure Melanie,
But the problem is not windows.
I want to get my PIC chip faster, I know that my hyperterminal can go faster, but my application on my picchip must go also faster.
I do not know how I come faster than 38 K.
Thanks in advance.

Melanie
- 15th July 2004, 21:36
There are a number of things you can do...

1. If you want to use the SOFTWARE Serial options then you pretty much run out of steam at 38k unless you trick PBP...

If you DON'T tell PBP that your OSC is 20MHz (it assumes 4MHz), then the formula changes and everything runs exactly 5x faster... The setting you had for 38k will now be 38k x 5. 9600 baud will be 48000 etc etc. Of course all other timing critical commands will be 5x faster too... Pause 1000 will only time for 200mS etc etc.

So... use available Hardware...

2. Use the hardware USART (if your PIC has one). It can hit 1.25Mb with a 20MHz xtal.

3. To minimise (zero is pretty minimal) communication errors at all standard baud rates, run your PIC with a 22.1184MHz (or 11.0592MHz) Crystal. These are known as BAUD RATE CRYSTALS and being a multiple of standard baud rates produce zero errors. Unfortunately, PBP doesn't provide an option for those baud rates, therefore there will be a timing error in other software commands (such as Pause etc) but choosing something close will minimise those and you can calculate the difference mathamatically and adjust accordingly.

mat janssen
- 16th July 2004, 06:32
Thank you Melanie.
I will try the to use the usart directly who is inside my chip.