B4R Question Serial Parity bit MARK

tzfpg

Active Member
Licensed User
Longtime User
i need to set wemos serial parity bits to MARK, how can i set that?
i already refer to these values but not seen SERIAL_8M1
B4X:
SERIAL_5N1 0x00
SERIAL_6N1 0x02
SERIAL_7N1 0x04
SERIAL_8N1 0x06
SERIAL_5N2 0x08
SERIAL_6N2 0x0A
SERIAL_7N2 0x0C
SERIAL_8N2 0x0E
SERIAL_5E1 0x20
SERIAL_6E1 0x22
SERIAL_7E1 0x24
SERIAL_8E1 0x26
SERIAL_5E2 0x28
SERIAL_6E2 0x2A
SERIAL_7E2 0x2C
SERIAL_8E2 0x2E
SERIAL_5O1 0x30
SERIAL_6O1 0x32
SERIAL_7O1 0x34
SERIAL_8O1 0x36
SERIAL_5O2 0x38
SERIAL_6O2 0x3A
SERIAL_7O2 0x3C
SERIAL_8O2 0x3E
 

tzfpg

Active Member
Licensed User
Longtime User
In this case I use 8,N and generate a parity bit using a table, to convert ASCII char to MARK parity. In both directions.
For MARK it's simple to add a 1 bit, without any fancy conversion.
how to do that? is it convert the hex to binary and then add one bit, parity mark is always 1, right?
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
I use OR 128 to add the most significant bit to the byte. To take off use AND 127. Yes it's always 1. Use 8,n for definition, so parity in not checked. To tell the truth MARK is not strictly a parity checking, since it's not calculated. In 45 years I have never seen any device using this feature.
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
I don't use B4R, so can be wrong, but according to the second link you posted, shouldn't it be in the second param of initialize2?
B4X:
myserial.initialize2(9600, 0x0E)
 
Upvote 0
Top