Go Down

Topic: Serial parity change in UNO/Leonardo (Read 795 times) previous topic - next topic

mrescude

Hi,
I need to simulate a sensor that communicates via rs-232, using 8 data bits, 1 odd bit and 1 stop bit. I'm using a Leonardo as "master" and the Uno as the "slave/sensor".
Looking at the microprocessors datasheets, I only need to change the UPMn1 register when I initialize the Serial in setup(). Its the same in both.

Code: [Select]

Serial.begin(9600);
UPMn1=1;


Is this correct? The Uno will send the data when the Leonardo sends the correct request code.

mrescude

Just in case someone is looking for the same thing,
Code: [Select]
UCSR0C=0x36 worked for me. That sets the bits in the USART Control and Status Register C to Enabled parity and Odd parity.

rweller

Was hoping for a bit of clarification on this subject. I'm guessing these types of changes refer to the hardware serial communications? I'm using softserial and need to modify communication parameters (other than baud)

pylon

For the SoftwareSerial library you cannot just change a configuration and it knows about parity. I've implemented a few variations of the SoftwareSerial library for some special parity/data bit combinations. What do you need?

Go Up