Pages: [1]   Go Down
Author Topic: Software serial missing parameter  (Read 1441 times)
0 Members and 1 Guest are viewing this topic.
Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7307
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use as follows

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

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




Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7307
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
 
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7307
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Pages: [1]   Go Up
Jump to: