Go Down

Topic: Software serial missing parameter (Read 1 time) previous topic - next topic

liudr

I found that the SoftwareSerial() documentation is missing the inverted option here and on arduino ide help:

http://arduino.cc/en/Reference/SoftwareSerialConstructor

I'm sure not many will need this feature but if I didn't use Mike Hart's original lib before I would not have known this feature. I was testing some serial sensor and all I got was garbage so I used SoftwareSerial and inverted option to find out that I needed the signal inverted. Without this option I'd have to do a lot of guesswork.

Also one more thing I learned from this, arduino serial idle seems to be 5V and signal is 0V. I didn't even know this before  :smiley-red: Am I correct? Thanks.

[Oops, maybe the wrong subforum, been trouble shooting this inverted signal and brain froze. Moderators, could you help move?]

Looserider

Use as follows

SoftwareSerial mySerial=SoftwareSerial(rx, tx, true); //Rx, Tx pins

The parameter  true (lower case) enables reading inverted serial input





liudr

Thanks. I know the answer. I just want to complain to the fact that they don't post this info on their site.

retrolefty

Quote
Also one more thing I learned from this, arduino serial idle seems to be 5V and signal is 0V. I didn't even know this before   Am I correct? Thanks.


Well a serial data stream is made up of both high and low states. A data bit (usually 8 of them) has a digital value of 1 when high (5v) and a digital value of 0 when at 0v. A start bit is always a 0 value and a stop bit is always a 1 value, and when there is no further data to be sent the line stays at the stop bit value, so idle is indeed a continuous +5vdc. So both 5v and 0v are valid signal values, it's just their bit position and use that may have you confused.

Lefty

liudr

Lefty, I don't have a logic analyzer so I never tested this out. Is 5V still representing logic 1 and 0V representing logic 0 in arduino? So does the software serial invert only invert the start/stop bit logic or both those and 0/1 logic?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy