Interrupt on Serial

Is there any chance that if send a data through serial via rx and tx it will be received on slave by interrupt just like spi?????
thank you

Hardware, or software serial? You can raise an interrupt on hardware serial, but it's more common to just poll an interrupt driven serial driver.

The Arduino Serial library already uses the serial interrupt to move incoming bytes from the UART into the Serial Input Buffer.

Have a look at the examples in Serial Input Basics - simple reliable non-blocking ways to receive data.

...R

aarg:
Hardware, or software serial? You can raise an interrupt on hardware serial, but it's more common to just poll an interrupt driven serial driver.

software serial , do you have any example ? Thanks

harveyyyyy:
software serial , do you have any example ? Thanks

It's likely that the library has examples

TheMemberFormerlyKnownAsAWOL:
It's likely that the library has examples

okay thank you

harveyyyyy:
software serial , do you have any example ? Thanks

Example:(untested)

1. Build the following circuit (Fig-1) between 2 UNOs using Software Serial Port.
uartUnoUno-23.png
Figure-1:

2. Upload the following sketch into UNO-1.

#include<SoftwareSerial.h>
SoftwareSerial SUART(2, 3);   //SRX = DPin-2, STX = DPin-3

void setup()
{
    Serial.begin(9600);
    SUART.begin(9600);
}

void loop()
{
    byte n = Serial.available();  //check if any character has come from InputBox of Serial Monitor (Fig-2)
    if(n !=0 )
    {
         char x = Serial.read();    //character has come and read it
         SUART.print(x);              //send character to UNO-2
         SUART.println();             //send Newline character to UNO-2
    }
  }

3. Upload the following sketch in UNO-2.

#include<SoftwareSerial.h>
SoftwareSerial SUART(2, 3);   //SRX = DPin-2, STX = DPin-3

void setup()
{
    Serial.begin(9600);
    SUART.begin(9600);
}

void loop()
{
    byte n = SUART.available();   //check if any character has come from UNO-1
    if(n !=0 )
    {
         char x = SUART.read();    //character has come from UNO-1 and read it
         Serial.print(x);                //send received character to Serial Monitor of UNO-2
    }
  }

4. Open Serial Monitor (Fig-2) of both UNO-1 and UNO-2. Keep 'line ending tab' at 'No line ending' option.

5. Enter A in the InputBox of the Serial Monitor of UNO-1 and then click on the Send button. Check that A has appeared on the OutputBox of the Serial Monitor of UNO-2.

6. This is the layout (Fig-2) of Serial Monitor.
SerialMonitor.png
Figure-2:

uartUNO-2.png

SerialMonitor.png

GolamMostafa:
Example:(untested)

1. Build the following circuit (Fig-1) between 2 UNOs using Software Serial Port.
uartUnoUno-23.png
Figure-1:

2. Upload the following sketch into UNO-1.

#include<SoftwareSerial.h>

SoftwareSerial SUART(2, 3);  //SRX = DPin-2, STX = DPin-3

void setup()
{
    Serial.begin(9600);
    SUART.begin(9600);
}

void loop()
{
    byte n = Serial.available();  //check if any character has come from InputBox of Serial Monitor (Fig-2)
    if(n !=0 )
    {
        char x = Serial.read();    //character has come and read it
        SUART.print(x);              //send character to UNO-2
        SUART.println();            //send Newline character to UNO-2
    }
  }




**3.** Upload the following sketch in UNO-2.


#include<SoftwareSerial.h>
SoftwareSerial SUART(2, 3);  //SRX = DPin-2, STX = DPin-3

void setup()
{
    Serial.begin(9600);
    SUART.begin(9600);
}

void loop()
{
    byte n = SUART.available();  //check if any character has come from UNO-1
    if(n !=0 )
    {
        char x = SUART.read();    //character has come from UNO-1 and read it
        Serial.print(x);                //send received character to Serial Monitor of UNO-2
    }
  }




**4.** Open Serial Monitor (Fig-2) of both UNO-1 and UNO-2. Keep 'line ending tab' at 'No line ending' option.

**5.** Enter A in the InputBox of the Serial Monitor of UNO-1 and then click on the Send button. Check that A has appeared on the OutputBox of the Serial Monitor of UNO-2.

**6.** This is the layout (Fig-2) of Serial Monitor.
![SerialMonitor.png|489x281](upload://fveB5dT0diZJbYXzelQCVkDNsDq.png)
Figure-2:

i will try this thank you for your help!!!