View previous topic :: View next topic |
Author |
Message |
burnsy
Joined: 18 Oct 2003 Posts: 35 Location: Brisbane, Australia
|
18F software uart interferes with hardware uart |
Posted: Mon May 23, 2005 6:46 am |
|
|
Here's and interesting one. I recently made the change from a 16F877 to 18F452. With a little help from this forum, a few port address changes and my whole program ported accross nicely.
However, I have a comms problem on the 18F that doesn't exist on my 16F processor. Too many printf statements stops comms on my hardware uart. I use the onboard hardware uart, with a 485 bus that connects to a bunch of other devices in a vending machine. It is interrupt driven.
Occaissionally, I need to print a receipt. I do this by calling a print receipt function, which uses the #use statement to reassign printif statements to a pin on porta. I have a printer hooked up to this pin. I print the req info to the printer, do another #use statement to put control back to the hardware uart and continue.
As I said this works fine on my 16f877, on many projects. On my 18F452 I can use 21 printf statements and all is fine, if I use 22 or more, my hardare uart doesn't function, from the start. I don't even call the print receipt function once???
Any clues without me posting the code (huge!)? I use pch 3.156.
thanks _________________ This is the last code change until its ready.... |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Mon May 23, 2005 7:25 am |
|
|
Have you tried using named streams instead of fooling around with extra #use statements? _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
burnsy
Joined: 18 Oct 2003 Posts: 35 Location: Brisbane, Australia
|
|
Posted: Tue May 24, 2005 6:51 am |
|
|
After your suggestion, I tried streams. I like that idea better (than the multiple #use statements), but didn't change anything. Add one too many printf statements and no comms.. damn it..
I was also able to crash comms by removing some printf statements. ??
thanks for your suggestions _________________ This is the last code change until its ready.... |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue May 24, 2005 11:04 am |
|
|
Maybe its not the number of printf's causing the problem but a particular one. |
|
|
burnsy
Joined: 18 Oct 2003 Posts: 35 Location: Brisbane, Australia
|
|
Posted: Wed May 25, 2005 2:37 am |
|
|
Turned out to be the compiler Mark. 3.209 works perfectly
now is there anysuggestions about I2C (grin)... _________________ This is the last code change until its ready.... |
|
|
|