View previous topic :: View next topic |
Author |
Message |
Storic
Joined: 03 Dec 2005 Posts: 182 Location: Australia SA
|
baud rate soft RS232 |
Posted: Sat Apr 22, 2006 6:33 am |
|
|
I would like to drive on a 18f1320 with a 8mhz internal osc, a soft rs232 at 115200 baud rate on B7 and B6. the Max I can get to work is 38400.
PIC18F1320 when set for SYNC = 0, BRGH = 1, BRG16 = 1 or SYNC = 1, BRG16 = 1, the chart tells me I can on B1 and B4 (hardware TX/RX)
As I had my RS485 LAN on B1/B4 I was able to test Via RS485 however even thoe I could see the correct data, I was getting errors (posible due to RS485 chip timing??)
Do I need to go to a Xtal or is there a work around on the soft comms to run at 16 bit insteat of 8.
the 115200 baud is required for the Bluetooth interface.
Andrew _________________ What has been learnt if you make the same mistake? |
|
|
Storic
Joined: 03 Dec 2005 Posts: 182 Location: Australia SA
|
|
Posted: Sun Apr 23, 2006 2:09 am |
|
|
from the pdf on the 18F1320 with enhance comms, it appears that soft comms follows the 8 bit calc and not the enhance
standard calc
8-bit/Asynchronous FOSC/[64 (n + 1)]
enhace calc
16-bit/Asynchronous FOSC/[4 (n + 1)]
On the standard calc, FOSC=8000000 SPBRG is 2 for 38400 with an error of 8.51%, This works OK to go above this I get an error.
If I can apply the enhance calc to soft comms @ FOSC=8000000 SPBRG is 16 for 115200 I would have an error of 2.12%, this setting seems to works on the hardware Comms. (TX/RX)
has anyone tried to program soft comms above the calc baud (SPBRG ), or would anyone know how I could do this.
any Coding suggestion would be appreciated. It looks like hardware changes may be the simple fix, I did not want to do this at this time.
Andrew _________________ What has been learnt if you make the same mistake? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sun Apr 23, 2006 8:23 am |
|
|
Software uart is limited by processor speed. |
|
|
Storic
Joined: 03 Dec 2005 Posts: 182 Location: Australia SA
|
|
Posted: Sun Apr 23, 2006 4:47 pm |
|
|
Thanks, I was thinking the same, however I hope there was a software fix, (revise design comming up)
Andrew _________________ What has been learnt if you make the same mistake? |
|
|
|