PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Stop bits |
Posted: Wed Mar 12, 2003 2:46 pm |
|
|
:=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 |
|