Last edited by sayzer; - 12th August 2008 at 15:45. Reason: typo.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
I could've swore that line abouot the resonator wasn't in that post a few minutes ago!
Yes, how does hardware 19,200 run at 4Mhz on a PIC18F2520?
Using one method, you get an +8.51% error in baud rate, doable, sometimes, as long as the sending serial port isn't on the low side, causing the tolerance to be even farther out.
Using the other method, you get a .16% error in baud. The sender has to be out in the weeds to cause that to mess up.
I'm voting for the first method...
It's all in the datasheets on how to set up the serial port using either method...
Hello based on the documentation of 18F2520, I can see that for 4 Mhz clock and speed 19.200, I have the bit error only 0.16 - Page 207 of the PDF.
My configuration is
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_SPBRG 12 'DEFINE HSER_BAUD 19200 on 4 Mhz
DEFINE HSER_CLROERR 1
Boban
And Skimask, I did mistake, I have PBP 2.46 not 2.49. Also for the serial communication, I have on the other side Ethernet module - XPORT direct.
Last edited by boban; - 12th August 2008 at 17:29.
Ok, now we're getting somewhere... Looks relatively normal so far.
All other things equal, I'd say something 'upstream' of the XPORT module is messing with your data, but that's just me and I'm guessing.
Get rid of the STR modifier in your SERIN statement and try just reading RAW data/numbers/characters/etc.
What is HSEROUT going to? Right back to the XPORT module? Is the feedback from the XPORT/PIC how you are verifying that it's sending/receiving data correctly?
And we still haven't seen your REAL code
And also no mention of the trasmitting device. If it is not sending the correct numbers in ASCII, we are playing Holmes here...
Ioannis
Hello, I have solved the problem. I have discoverred, that each 3rd character received doesn't correspond to the ASCII code. I have tried to change the speed of the communication and it is working. So the problem was, that some of the bits were not readed correctly. Now I am wondering why at 115200 bps it is working, because in the PIC manual is written, that there is 8% error rate at 4 Mhz and 115200 and at 19200 the error rate is only 0.6 %.
Bookmarks