How can I set the SoftwareSerial to communicate with 9600baud, 7 bits data, Even Parity, 1 stop bit, no flow control device?
I am using Arduino-0023 and SoftwareSerial library. If NewSoftSerial can do this, I will update to Arduino 1.0.
Can anybody help me? Thanks.
7-bit Even Parity is just like 8-bit, No Parity except the high bit is determined from the other 7 on send and receive. You could re-write any of the software serial libraries or you could do it in software:
For each byte to be sent:
Count the 1 bits in the bottom 7 bits of the byte.
if the count is odd, set the top bit to 1, else set it to 0
send the byte.
You can similarly check the parity on received bytes or just mask the parity bit off: (byte & 0x7F)
Hi, johnwasser, thanks very much.
What I expect to receive is "30 31 31 38 34 37" and what I actually read by arduino is "30 B0 B0 B8 B0 B6"
expect actually read expect read
30: 00110000 >>>>>> 30: 00110000 ----- 30: 00110000
31: 00110001 >>>>>> B0: 10110000 ----- B1: 10110001
31: 00110001 >>>>>> B0: 10110000 ----- B1: 10110001
38: 00111000 >>>>>> B8: 10111000 ----- B8: 10111000
34: 00110100 >>>>>> B0: 10110000 ----- B4: 10110100
37: 00110111 >>>>>> B6: 10110110 ----- B7: 10110111
what do you think is the problem that make the bits wrong?
what do you think is the problem that make the bits wrong?
I'm going to go out on a limb and guess that it is your code that makes the bits wrong. Without seeing your code, though, we'll never know.