UART parity setting as "mark" or "space" (using Pyserial???)

Grant Edwards grante at visi.com
Fri Nov 4 09:16:53 EST 2005


On 2005-11-03, Petr Jakes <petr at tpc.cz> wrote:

> Using Pyserial it is possible to set the parity bit as ODD, EVEN or
> NONE.

Correct.  Those are the parity settings supported by pretty
much all platforms.

[...]

> Does anybody here knows some "tricks" how to set up the mark
> and space parity on the UART (using pyserial???),

What OS?  Mark and space parity are not supported by the Unix
termios API that is used to do serial port stuff.

> so I can simulate 9bit communication? (I know it sounds silly,
> but I would like to try to re-configure the UART parity before
> each byte transmission).

I suspect you're going to have to talk to the UART yourself to
do this.  

In addition to the problem with mark/space being unsupported,
you have to wait until each byte is completely sent (including
the parity bit) before changing the parity and loading the next
byte into the data register.  Many OSes "drain" functions are
notoriously inaccurate.

-- 
Grant Edwards                   grante             Yow!  Did I say I was a
                                  at               sardine? Or a bus???
                               visi.com            



More information about the Python-list mailing list