Pages: [1]   Go Down
Author Topic: Pin 1 (Serial TX) usage  (Read 1182 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm currently working on an arduino sketch (EEPROM programmer) that receives serial data from a computer, then outputs data\address info through the I/O pins. However, I need one more I/O pin for the address bus... Since I'm only receiving data through the serial port, I was hoping that I could use pin 1 (TX) for digital I/O, but the Arduino wouldn't listen to my digitalWrite commands.

Is there any way I can use pin 1 in my project while still receiving serial data?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There was a modification of the HardwareSerial class posted recently that allowed read-only, write-only, or read-write access to the serial port pins.

Have you used all the analog pins, too. They can be used as digital pins.
Logged

0
Offline Offline
Shannon Member
****
Karma: 199
Posts: 11650
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you use Serial it configures the hardware UART to take over pins 0 and 1 - in this case they cannot be used with digitalWrite().  Use SoftwareSerial instead perhaps?

Alternatively look at the code in HardwareSerial.cpp and figure out what to override.  [ or look the posting mentioned above ]
Logged

[ I won't respond to messages, use the forum please ]

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 286
Posts: 25666
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://arduino.cc/forum/index.php/topic,125110.0.html
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 142
Posts: 5290
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm currently working on an arduino sketch (EEPROM programmer) that receives serial data from a computer, then outputs data\address info through the I/O pins. However, I need one more I/O pin for the address bus... Since I'm only receiving data through the serial port, I was hoping that I could use pin 1 (TX) for digital I/O, but the Arduino wouldn't listen to my digitalWrite commands.

Is there any way I can use pin 1 in my project while still receiving serial data?

The USART has priority over normal pin operations when it's enabled. You can disable the transmitter by clearing a bit in USCR0B.

Go read the datasheet for more details... smiley

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

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


Thank you! I'll be sure to try this.
Logged

0
Offline Offline
Shannon Member
****
Karma: 199
Posts: 11650
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Or look in the begin() function: the line
Code:
 sbi(*_ucsrb, _txen);
seems to be the obvious candidate.  Though that's in terms of variables and #definery.
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: