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 support@ccsinfo.com

RS232 - number of Stop Bits

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



Joined: 28 Mar 2006
Posts: 10

View user's profile Send private message

RS232 - number of Stop Bits
PostPosted: Tue Mar 28, 2006 8:05 am     Reply with quote

I need to talk to a device using 9600 baud, 8 data bits, No Parity, 2 stop bits. Is this possible with the PIC and if so, how do I set it up ? I can't see anywhere that specifies the number of stop bits used.

Regards

Alan
mpfj



Joined: 09 Sep 2003
Posts: 95
Location: UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Mar 28, 2006 8:56 am     Reply with quote

You need to put the PIC into 9 bit serial mode, and always set the 9th bit to a '1' when you send a character.

This will give you ...

<1 x START> <8 x DATA, 1 x STOP> <1 x STOP>

Simple, eh ? Very Happy
spesh



Joined: 28 Mar 2006
Posts: 10

View user's profile Send private message

PostPosted: Tue Mar 28, 2006 9:26 am     Reply with quote

I'm unfamiliar with using 9-bit mode. Can I get the compiler to do this automatically or do I have to access the config registers directly ?

Any pointers (excuse the punn) very much appreciated

Cheers

Alan
SherpaDoug



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

View user's profile Send private message

PostPosted: Tue Mar 28, 2006 9:28 am     Reply with quote

BTW, If you are only listening to the device, you can listen with 1 stop bt. It is only when you transmit to it that it needs a little extra delay between bytes so a second stop bit is added.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Ttelmah
Guest







PostPosted: Tue Mar 28, 2006 9:33 am     Reply with quote

The compiler can do it directly (bits=9). You have a 'choice', of sending 9 bit values to the I/O routines (using int16's), or of accessing the bit in the RS232_ERRORS byte. Older compilers only support the latter. The supplied RS485 driver, uses 9 bit mode, so you can see how it is done in this.

Best Wishes
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