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

RS232 Parity problems

 
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

RS232 Parity problems
PostPosted: Fri Nov 03, 2006 5:52 am     Reply with quote

Using compiler version 3.181
I declare my RS232 as
Code:
#use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=9,invert)


When the program is relatively small it operates fine with the RS232 data being displayed as expected. (Using Tera Term).
However when more functionality is added then the RS232 data received can only be viewed (other than corrupt data) when the parity is set to odd or even.
Anyone any ideas.
Thanks
Steve
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Fri Nov 03, 2006 7:46 am     Reply with quote

Do not exist any relation between the parity, the complexity that a program
can be and data corruption, but if to add more functionalities means to enable
some timers, that could be the problem of receiving corrupted data.
Work around, try disabling global interrupt when your code get or put a char to
prevent data corruption.

Humberto
Guest








PostPosted: Fri Nov 03, 2006 8:46 am     Reply with quote

Thanks Humberto.
Had thought about that before I tried changing the Parity setting.
I have no timers running at all in the program. Most of the time it is asleep and woken up on interrupt to check a port then write some data to an eeprom.
BUT the code added is not even called upon when the RS232 data is written to the screen.
Still confused. Why would this cause a problem that can be solved by using a parity setting to display the RS232 data?
Thanks
Steve
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sat Nov 04, 2006 12:16 am     Reply with quote

Just some comments:

1) Are you using the Parity for any kind of checking or error detection in your communications ?
2) Are you really using the nineth bit for addressing or something else?

If not, did you try using:
Code:

#use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8,invert)


Posting a compilable code is a must if you expect better helping.


Humberto
Guest








PostPosted: Tue Nov 07, 2006 4:48 am     Reply with quote

Thanks again Humberto. Great advice.
Changed to bits=8 and all fine.
Kicking myself that I didn't spot that.
Cheers
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