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

1wire RS232

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



Joined: 13 Oct 2003
Posts: 32

View user's profile Send private message Send e-mail

1wire RS232
PostPosted: Sun Oct 16, 2011 8:30 am     Reply with quote

I have two pics that are communicating using 1wire and a 10k resistor.
They do chatter back and forth but my problem is sometimes some of the data being sent is not being received, or if it is its corrupted.

My declaration on the pic not receiving the data is as follows
#use RS232(BAUD = 1200, XMIT=PIN_c2, RCV=PIN_c2, float_high, ERRORS)

Any suggestions as to how I can resolve this?

Many thanks
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Oct 16, 2011 10:28 am     Reply with quote

CCS has a couple of examples of code in the 'examples' folder and/or the FAQ section of the onscreen manual..maybe that might have some ideas ?
Chibouraska



Joined: 11 May 2007
Posts: 57
Location: Montreal,Canada

View user's profile Send private message

PostPosted: Sun Oct 16, 2011 5:21 pm     Reply with quote

What value crystal are you using and does the errors occur in sequence or all over the received stream of data?
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Oct 16, 2011 5:34 pm     Reply with quote

hmm..you don't say which PIC and if you're using the internal oscillator,even at 1200 baud, they might be off just enough(one more, one less) to cause miscommunications.....
delene



Joined: 13 Oct 2003
Posts: 32

View user's profile Send private message Send e-mail

PostPosted: Sun Oct 16, 2011 11:38 pm     Reply with quote

It occours with the pic16f877a and the pic18f452.
Am using a 4 meg crystal

The only idea that I came up with from the examples is to change my pin to be one with an external interrupt. However I am using port b with an LCD display so I don't know if this is going to be possible. Guess I will try it and find out
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Oct 17, 2011 7:07 am     Reply with quote

Exactly HOW is the data corrupted? Is it bit shifted? that indicates you are not catching the Start bit correctly. Are the bits at the end of the byte bad, but those at the start of the byte are OK? That inicates a baud rate error. Are totally random single bits erroniously 1 or 0? That indicates electrical interference.

Can you put a scope on the serial line and see if there is bus contention (two transmitters fighting and producing midway voltages).
_________________
The search for better is endless. Instead simply find very good and get the job done.
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