Pages: [1]   Go Down
Author Topic: How to invert serial polarity  (Read 1470 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Norfolk UK
Offline Offline
Edison Member
*
Karma: 65
Posts: 2442
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
« Last Edit: January 31, 2013, 12:43:47 pm by Riva » Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 515
Posts: 26261
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

That works perfectly. Thank you!
Logged

Pages: [1]   Go Up
Jump to: