View previous topic :: View next topic |
Author |
Message |
spesh
Joined: 28 Mar 2006 Posts: 10
|
RS232 - number of Stop Bits |
Posted: Tue Mar 28, 2006 8:05 am |
|
|
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
|
|
Posted: Tue Mar 28, 2006 8:56 am |
|
|
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 ? |
|
|
spesh
Joined: 28 Mar 2006 Posts: 10
|
|
Posted: Tue Mar 28, 2006 9:26 am |
|
|
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
|
|
Posted: Tue Mar 28, 2006 9:28 am |
|
|
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
|
|
Posted: Tue Mar 28, 2006 9:33 am |
|
|
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 |
|
|
|