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

Stop bits

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







Stop bits
PostPosted: Wed Mar 12, 2003 9:44 am     Reply with quote

Im trying to implement wireless data communications using the PIC 16F627. I have read 2 conflicting pieces of information and would like to know the correct answer!

My datasheet for the PIC tells me that it uses 1 stop bit, while a document i read on the web tells me that the CCS complier uses 2 stops when using the rs232 command parameter.

Could someone please adivse me on this point. Further to that, if it is dependent on Hardware (i.e. only 1 stop bit) could someone please adivse how i may implement 2 stop bits.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12569
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Stop bits
PostPosted: Wed Mar 12, 2003 2:46 pm     Reply with quote

:=Im trying to implement wireless data communications using the PIC 16F627. I have read 2 conflicting pieces of information and would like to know the correct answer!
:=
:=My datasheet for the PIC tells me that it uses 1 stop bit, while a document i read on the web tells me that the CCS complier uses 2 stops when using the rs232 command parameter.

I notice you didn't give a link to this document.
:=
:=Could someone please adivse me on this point. Further to that, if it is dependent on Hardware (i.e. only 1 stop bit) could someone please adivse how i may implement 2 stop bits.

The compiler supports 2 stop bits. You have to specify
in the #use rs232 statement that "bits = 9".
Then you need to set the 9th bit = 1. The way to do that,
depends upon whether you're using a hardware or software usart.

// Hardware USART (on a 16F877)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, bits = 9, ERRORS)

// Software USART
#use rs232(baud=9600, xmit=PIN_B1, rcv=PIN_B0, bits = 9, ERRORS)

#bit TXD9_BIT = 0x98.0 // Use this line for a hardware USART

void main()
{

// For a hardware USART, set the 9th bit to a stop-bit level.
TXD9_BIT = 1;

// For a software USART, do it this way.
bit_set(rs232_errors, 7);


// Send some RS-232 chars, as a test.
putc('A');
putc('B');
putc('C');

while(1);
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 12584
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