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 |
|
![](templates/subSilver/images/spacer.gif) |
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 ? ![Very Happy](images/smiles/icon_biggrin.gif) |
|
![](templates/subSilver/images/spacer.gif) |
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 |
|
![](templates/subSilver/images/spacer.gif) |
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. |
|
![](templates/subSilver/images/spacer.gif) |
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 |
|
![](templates/subSilver/images/spacer.gif) |
|