CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Serial Data Corruption

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stma



Joined: 16 Feb 2004
Posts: 26

View user's profile Send private message

Serial Data Corruption
PostPosted: Mon Oct 30, 2006 9:21 am     Reply with quote

Hi,
I am using a PIC16LF876 and have a program which does various functions.
(would post code but it is rather long)
Anyway, I use serial data outputs (using PRINTF) to display information on the PC via a terminal program. This has all been working fine until I recently added code to the program to increase its functionality. Now whenever I write to the screen it is corrupt. (looks like it would when the incorrect Baud rate is selected, but this is not the case).
The (shorter) program works fine but the added codes creates this problem.
even just doing a simple PRINTF which is in no way connected to the rest of the program is corrupt.
Any ideas??
Thanks
Steve
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Mon Oct 30, 2006 12:20 pm     Reply with quote

stma wrote:
Any ideas??


Yes.... you broke it when you added 'functionality.' (OK, so you've probably already figured that out.) Since one of the pros hasn't answered up, there probably isn't a quick, obvious fix.

First, go back to your old code and confirm the hardware is still working.

Second, slowly add your new code and test after each addition or add it all and start commenting out as much of your 'added functionality' as you can to see if you can get it working again. The only thing you can do is isolate the offending code (if that's what it is) and locate it that way.

Good luck,

John
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 30, 2006 1:32 pm     Reply with quote

Quote:

I use serial data outputs (using PRINTF) to display information on the PC
via a terminal program. This has all been working fine until I recently
added code to the program to increase its functionality. Now whenever
I write to the screen it is corrupt.

This could happen if you're using a software UART and you enable
interrupts for some other device (such as a timer, or external interupts,
etc.). The interrupt will disrupt the timing of the pulses in the software
UART.
Example: Add the parameter shown in bold below.
Quote:
#use rs232(baud=9600, xmit=PIN_B1, rcv=PIN_B0, DISABLE_INTS)
stma



Joined: 16 Feb 2004
Posts: 26

View user's profile Send private message

PostPosted: Tue Oct 31, 2006 2:21 am     Reply with quote

Thanks for the replies.
I will have a look at the code.
Interesting thing this morning. The program correctly receives data from the keyboard (PC) and always has done.
I changed my terminal settings to have ODD or EVEN Parity and hey presto it works as normal (previously using 8N1)
Haven't a clue why this is. If anyone could shed light on it it would be interesting to find out why this occurs.
Thanks
Steve
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group