UART implementaion

Hi everyone:
I have ti implement UART in arduino without using the actual rx (pin0) and tx(pin 1).
The idea is to transmit data and receive it using pin
2 and 3.
I have to connect Rx pin to pin 2
and Tx pin to pin 3.
Im not allowed to use any library as SoftwareSerial
or SPI....
I need Transmit and receive using digital write and digital read command and then make of zeros and ones logic char or string.
I have no idea how to do that and how to disable normal rx/ tx and use pin 2,3 instead.
Moreover Im not allowed to make register programming
Can any one help me with this top?

Mazen2000:
I have no idea how to do that and how to disable normal rx/ tx and use pin 2,3 instead.
Moreover Im not allowed to make register programming

Can you post the exact text of your assignment. Some of these requirements seem very strange.

For example why would it be necessary to disable Rx and Tx on pins 0 and 1?

I think you are being asked to create your own version of SoftwareSerial - and if I give you the solution you won't be entitled to any credit for your project.

...R

Mazen2000:
Hi everyone:
I have ti implement UART in arduino without using the actual rx (pin0) and tx(pin 1).
The idea is to transmit data and receive it using pin
2 and 3.
I have to connect Rx pin to pin 2
and Tx pin to pin 3.
Im not allowed to use any library as SoftwareSerial
or SPI....
I need Transmit and receive using digital write and digital read command and then make of zeros and ones logic char or string.
I have no idea how to do that and how to disable normal rx/ tx and use pin 2,3 instead.
Moreover Im not allowed to make register programming
Can any one help me with this top?

First note it to pint out your first statement is you are not to use pin 0 and pin 1, not that you are to disable them. Just don't use them in you program.

The second thing is for you to learn how to make a timer based on the Baud rate of your communication speed. Once you can do that, then you need to understand how the timer can be used as an interrupt.

Paul

So, you want to transmit the following ASCII frame (for example) for character A using DPin-3 of UNO. Assume 9600 Bd, each bit will take about 104 us to get out. Try the the codes that follow:
asciiFrameX.png
Figure-1:


Figure-2:

The codes at the TX side:

byte x = 0x41;  // or byte x = 'A'; hold the ASCII code for character to be transmitted

digitalWrite(3, LOW);
delayMicroSeconds(104);      //assert START bit
for(int i= 7; i>=0; i--)
{
    digitalWrite(3, bitRead(x, i));
    delayMicroSeconds(104);
}
digitalWrite(3, HIGH); 
delayMicroSeconds(104);  //assert STOP bit

The Codes at the RX side:
Try yourself.

asciiFrameX.png