Go Down

Topic: Pin 1 (Serial TX) usage (Read 1 time) previous topic - next topic

bob800

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?

PaulS

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.

MarkT

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 ]
[ I won't respond to messages, use the forum please ]

AWOL

http://arduino.cc/forum/index.php/topic,125110.0.html
"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.

fungus


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... :)

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

bob800


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


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

MarkT

Or look in the begin() function: the line
Code: [Select]
 sbi(*_ucsrb, _txen);
seems to be the obvious candidate.  Though that's in terms of variables and #definery.
[ I won't respond to messages, use the forum please ]

Go Up