View previous topic :: View next topic |
Author |
Message |
Roebi
Joined: 12 Jan 2006 Posts: 6
|
Soft-RS232 kills SPI |
Posted: Tue Feb 07, 2006 7:49 am |
|
|
My application runs on a 16F76. It uses The UART as well as SPI - both are on port C. In order to debug my program I added:
#use rs232(baud=19200,parity=N,xmit=PIN_C0,rcv=PIN_C1,bits=8,DISABLE_INTS,stream=dbgs)
also on port C. While the soft-RS232 works fine - e. g. with the statement
fprintf(dbgs,"\r\naci:%2u",aci);
it has the ugly side effect, that the SPI no longer works. There are just no more clock pulses when calling the built in function spi_write or spi_read.
Who knows a remedy against this? Thanks for help.
Robert |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Feb 07, 2006 12:14 pm |
|
|
This might be a TRIS problem.
1. Post a small, simple program that demonstrates the problem.
Just a few lines of code. Make sure to post all of your #use,
#fuses, #include and #device statements.
2. Post your compiler version. It's given at the top of the .LST
file, which is in your project folder. It will be a number such
as 3.191 or 3.242, etc. |
|
|
Roebi
Joined: 12 Jan 2006 Posts: 6
|
More on RS232 problem: Work-around |
Posted: Thu Feb 09, 2006 4:39 am |
|
|
It is indeed a TRISC-problem . Following any call to
fprintf(dbgs,....etc
the TRISC-bits 3..5 are all ones. No supprise SPI does not work anymore. The work-around is to set TRISC prior to any use of spi_read or spi_write. But - hellas - why does the soft-RS232-code mess around with bits of TRISC that are absolutely not its business?
I am using PCW V3.242 |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Feb 09, 2006 8:17 am |
|
|
As was told you before: post a small compilable program that demonstrates your problem. We know it will take you some effort to produce such a program, but you want our help, so don't put the effort on us.
The easier you make it for us to investigate your problem, the quicker and better responses you'll get. |
|
|
|