0

Suppose delay(10000) function is executed, so Arduino cannot do any other work.

During this time if the other device sends the data to arduino what will happen ?

asked Feb 4, 2017 at 17:32

1 Answer 1

2

Depending on the memory available, between 16 and 256 bytes will be stored in a ring buffer. Any bytes that arrive after that will be just thrown away.

The reception code in the core is:

void HardwareSerial::_rx_complete_irq(void)
{
 if (bit_is_clear(*_ucsra, UPE0)) {
 // No Parity error, read byte and store it in the buffer if there is
 // room
 unsigned char c = *_udr;
 rx_buffer_index_t i = (unsigned int)(_rx_buffer_head + 1) % SERIAL_RX_BUFFER_SIZE;
 // if we should be storing the received character into the location
 // just before the tail (meaning that the head would advance to the
 // current location of the tail), we're about to overflow the buffer
 // and so we don't write the character or advance the head.
 if (i != _rx_buffer_tail) {
 _rx_buffer[_rx_buffer_head] = c;
 _rx_buffer_head = i;
 }
 } else {
 // Parity error, read byte but discard it
 *_udr;
 };
}
answered Feb 4, 2017 at 18:32

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.