Receiving Serial data from Three Serial ports

Hi,

I need to get the datato arduino Mega from Three boards which are running independently.

all the collected data will be shown on the serial monitor using Arduino mega.

Can I do this using SerialEvent() function

Arduino mega has SerialEvent() for Three Serial Ports.

which serial will it choose when Two Serials Receive the data at the same time?

SerialEvent() is called when there is data available.

if the program is in the process of handling/parsing the first serial message, will it interrupt/abandon this process as soon as another SerialEvent on another port is triggered? Or will it complete the first SerialEvent routine before going to the second one?

Answer: Don't use SerialEvent. Check for available serial data using Serial.available(), Serial1.available() and Serial2.available()

On the mega you could use SerialEvent, SerialEvent1 and SerialEvent2 but why bother ?

SerialEvent() is called when there is data available.

No, it is called every time through the infinite loop in "main()"

AWOL:
No, it is called every time through the infinite loop in "main()"

I know i am not expert here.. But the reference says it...

serialEvent()

Description

Called when data is available. Use Serial.read() to capture this data.

UKHeliBob:
Answer: Don't use SerialEvent. Check for available serial data using Serial.available(), Serial1.available() and Serial2.available()

On the mega you could use SerialEvent, SerialEvent1 and SerialEvent2 but why bother ?

like I said how can I handle if two serials receive data at the same time...

I dont know it may be stupid question..
I think when ever there is data in Serial Buffer It will automatically send to the buffer right..?
so when it receiving in three serials at the same time does it store the all data in all three buffers?

like I said how can I handle if two serials receive data at the same time...

You will be checking whether there is any serial data available one after the other so it does not matter if several serial buffers have data in them.

so when it receiving in three serials at the same time does it store the all data in all three buffers?

No. The data from each serial interface will be stored in a separate buffer waiting for you to notice it and deal with it.

Sorry, the point I was trying to make (badly) was that the reference seems to imply that SerialEvent is called as soon as data becomes available, which is just not the case.