Pages: [1]   Go Down
Author Topic: Serial parity change in UNO/Leonardo  (Read 753 times)
0 Members and 1 Guest are viewing this topic.
SJ, Costa Rica
Offline Offline
Newbie
*
Karma: 2
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Serial.begin(9600);
UPMn1=1;

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

SJ, Costa Rica
Offline Offline
Newbie
*
Karma: 2
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Pages: [1]   Go Up
Jump to: