UART/ TX Question

Hi folks :slight_smile:

Bellow is a simple code which I am using to send 3 bytes of data as following

byte 0 :0x7B (this value is a hexadecimal)
byte 1: 0xCC
byte 2: 0x9C

byte array_Buff [3]  ;
int i;

// SETUP *************************************************************************
void setup()
{
  Serial.begin(9600);      // start serial communication at 9600bps
 // pinMode(a_Out, OUTPUT);
 // Serial1.begin(9600);     // start serial1 communication at 9600bps
 i=0;
} // End Setup


// LOOP *************************************************************************
void loop()
{
array_Buff [0]= B01111011;
array_Buff [1]= 0xCC;
array_Buff [2]= 0x9C; 

while(i<1) {
 Serial.write(array_Buff ,3 );
 i++;
}

}  // End Loop.

My question is that,
does the arduino pulls down the TX by itself in order to let the other device know it is sending information? If not? How could I signal the beginning of data transfer ?

Thank You,

No, it doesn't. The Rx and Tx are independent. The Tx waits for incoming data (interrupt routine) while the Rx is sending. You can use another pin for signalling the beginning of data transfer. e.g DTR signal.

Budvar10: No, it doesn't. The Rx and Tx are independent. The Tx waits for incoming data (interrupt routine) while the Rx is sending. You can use another pin for signalling the beginning of data transfer. e.g DTR signal.

I suspect you have that back to front :)

And I am not sure that the initial "No" is correct either

miladnkw: does the arduino pulls down the TX by itself in order to let the other device know it is sending information? If not? How could I signal the beginning of data transfer ?

In Serial communication the TX line is HIGH in the idle state. The start bit is, in effect, when that is pulled LOW by the TXing device

However I don't understand why you are asking this question. Normally "it just works" and there is no need to enquire about the inner workings. What are you trying to do that has given rise to your question?

...R

Hey Robin, I believe you are right. My understanding is that the serial.Write() takes care of pulling down the TX line and initiating the transfer signal. As for what I am doing, I am trying to interface an Arduino with a FPGA so I need to count for the beginning signal on the receiver side (FPGA).

miladnkw: My understanding is that the serial.Write() takes care of pulling down the TX line and initiating the transfer signal. As for what I am doing, I am trying to interface an Arduino with a FPGA so I need to count for the beginning signal on the receiver side (FPGA).

I think you need to find a web page that describes the bit-sequence of a Serial byte. You can assume that the Arduino does it properly. The trick is to test the status of the line in the middle of each bit period having been alerted by the line going from HIGH to LOW at the beginning of the start bit.

The code in Yet Another Software Serial was written to receive (and transmit) serial data without using the USART. It may (or may not) help to illustrate the subject for you.

...R

Robin2: I suspect you have that back to front :)

:-* Shame on me! Please, ignore my post.