RS232 word size with or without parity

The bytesize attribute in a sequential class is defined as the number of data bits used for this connection. If I enable odd parity, will it convert one of the specific data bits to indicate parity? Or does he just add another bit between the start and stop bits?

import serial

# Define a serial instance with 8 databits and no parity
my_com = serial.serial(bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE)
# My rs232 frame would now look something like:
[ START_BIT, DB0, DB1, DB2, DB3, DB4, DB5, DB6, DB7, STOP_BIT ]

# Change the parity settings
my_com.parity = serial.PARITY_ODD

# Do my frames now look like this
[ START_BIT, DB0, DB1, DB2, DB3, DB4, DB5, DB6, DB7, PARITY, STOP_BIT ]
# or do they look like this?
[ START_BIT, DB0, DB1, DB2, DB3, DB4, DB5, DB6, PARITY, STOP_BIT ]

Any help would be greatly appreciated. Thanks

+3
source share
1 answer

The parity bit is added as an extra bit after DB7.

See this illustration on RS232 timing from Wikipedia. It has a few German bits, but it perfectly shows how parity is an extra bit in addition to data bits 0-7.

, , UART + , , ( - " ", " " ).

9- , Multidrop bus (. fooobar.com/questions/1985521/...), 9- ( " " ), . 9- "8- " RS232/RS485 .

+1

All Articles