Go Down

Topic: How to invert serial polarity (Read 2131 times) previous topic - next topic

On the Arduino Uno, I would like to invert the polarity of the serial tx signal. The default setting is logic high = 5V. I would like to invert it to logic high = 0V.
I am able to do this using SoftwareSerial using the argument, true:

SoftwareSerial mySerial(10,11,true);

However, the SoftwareSerial's maximum speed is 115200 and I would like to run faster than that.
Is there a way to invert the serial polarity?

Riva

#1
Jan 31, 2013, 06:26 pm Last Edit: Jan 31, 2013, 06:43 pm by Riva Reason: 1
I'm not sure if the on chip USART supports inverted logic so you will probably need to run the signal(s) through a NOT gate like a 7404 (Expect to be told this is not suitable here)
I might seem like an idiot but remember it takes one to know one.
Forum user generally fall into three categories (the good, the bad & the a**hole) what category do you fit in?

CrossRoads

Run the line thru a transistor inverter with open collector (OC) output.
2N2222A or similar NPN transistor , 2 resistors.
When Tx is high, OC is low; when TX is low, OC is high.

Hardware serial can do up to 1Mbps rates. Don't know if the serial libary supports that directly.
I think I tested as high as 250000 with just small burts of data.

See Section 20 of the datasheet for hardware discussion.  Table 20-7 for supported speeds with 16 MHz system clock.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


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