user14350: I have three sensors latched on to three different Arduino devices. 
The respective Arduino devices are connected on to an Arduino Mega on Serial1, Serial2 and Serial3. 
The data from each device component (i.e., an Arduino with an accompanying sensor) were sent in data packets with different starter byte headers ('$' , '/' & '#' ) accompanying the buffered data from each individual device component onto the Mega on the Tx/Rx lines. 
My question here is, how can I simultaneously read out all the data from the different serial ports on the Arduino mega sketch?

user14350: I had my arduino mega receiving the data from Serial2 and Serial3, by adopting a sketch that was developed by @Majenko in answer to the post Processing Serial data. The sketch below outputs data to the serial monitor. The NEW problem I have now is trying to develop a python sketch that would seperate the data from the buffers into two different csv files, with each csv files representing the data from each of the two sensors.
    static char buffer[20];
    int count =0;

    void setup() 
   {
    Serial.begin(115200);
    Serial2.begin(115200);
    Serial3.begin(115200);
    delay(50);

    }

    void loop(){

if (Serial.available()){  //Slide the window
   for(count=0; count<10; count++){
      buffer[count] = Serial.read();
      //Add the new character
      buffer[9] = Serial.read();

      //Check the framing window
   if((buffer[0] == '$') && (buffer[9] == 0xAC)){
     //Calculate the checksum
      uint16_t cs = 0;
   for (uint16_t i = 2; i < 8; i++){
    cs += buffer[i];
    }
    //if the checksum matches....
    if(cs == buffer[8]){
      //Send the byte to serial port three
      Serial2.write(buffer, count); 
  }
  }

 }
}

 if (Serial2.available()){
    for(count=0; count<10; count++){
      buffer[count] = Serial2.read();
      //Send the byte to serial port three
      Serial.write(buffer, count); 
     }
 }

 if (Serial.available()){  //Slide the window
   for(count=11; count<20; count++){
      buffer[count] = Serial.read();
      //Add the new character
      buffer[19] = Serial.read();

      //Check the framing window
   if((buffer[11] == '+') && (buffer[19] == 0xAE)){
     //Calculate the checksum
      uint16_t cs2 = 0;
   for (uint16_t i = 6; i < 18; i++){
    cs2 += buffer[i];
    }
    //if the checksum matches....
    if(cs2 == buffer[18]){
      //Send the byte to serial port three
      Serial3.write(buffer, count); 
  }
  }

 }
}

 if (Serial3.available()){
    for(count=11; count<20; count++){
      buffer[count] = Serial3.read();
      //Send the byte to serial port three
      Serial.write(buffer, count); 
     }
 }

}

user13432: 
My question here is how can I simultaneously read out all the data from the different serial ports on the arduino mega sketch.

As you are using several serial ports data can already be received simultaneously. Each serial software class (Serial1, Serial2, Serial3) has an internal buffer where data is stored until it is read. 
You only need to read the data before the internal buffers are filled and there is a risk for over-flow. Check that data is available and read as usual per serial port. Avoid any blocking calls to avoid buffer over-flow. 
Cheers! 

14350: <p>I have three sensors latched on to three different Arduino devices. </p>

<p>The respective Arduino devices are connected on to an Arduino Mega on Serial1, Serial2 and Serial3. </p>

<p>The data from each device component (i.e., an Arduino with an accompanying sensor) were sent in data packets with different starter byte headers ('$' , '/' &amp; '#' ) accompanying the buffered data from each individual device component onto the Mega on the Tx/Rx lines. </p>

<p>My question here is, how can I simultaneously read out all the data from the different serial ports on the Arduino mega sketch?</p>
 14350: <p>I had my arduino mega receiving the data from Serial2 and Serial3, by adopting a sketch that was developed by @Majenko in answer to the post <a href="https://arduino.stackexchange.com/questions/19818/processing-serial-data">Processing Serial data</a>. The sketch below outputs data to the serial monitor. The NEW problem I have now is trying to develop a python sketch that would seperate the data from the buffers into two different csv files, with each csv files representing the data from each of the two sensors.</p>

<pre><code>    static char buffer[20];
    int count =0;

    void setup() 
   {
    Serial.begin(115200);
    Serial2.begin(115200);
    Serial3.begin(115200);
    delay(50);

    }

    void loop(){

if (Serial.available()){  //Slide the window
   for(count=0; count&lt;10; count++){
      buffer[count] = Serial.read();
      //Add the new character
      buffer[9] = Serial.read();

      //Check the framing window
   if((buffer[0] == '$') &amp;&amp; (buffer[9] == 0xAC)){
     //Calculate the checksum
      uint16_t cs = 0;
   for (uint16_t i = 2; i &lt; 8; i++){
    cs += buffer[i];
    }
    //if the checksum matches....
    if(cs == buffer[8]){
      //Send the byte to serial port three
      Serial2.write(buffer, count); 
  }
  }

 }
}

 if (Serial2.available()){
    for(count=0; count&lt;10; count++){
      buffer[count] = Serial2.read();
      //Send the byte to serial port three
      Serial.write(buffer, count); 
     }
 }

 if (Serial.available()){  //Slide the window
   for(count=11; count&lt;20; count++){
      buffer[count] = Serial.read();
      //Add the new character
      buffer[19] = Serial.read();

      //Check the framing window
   if((buffer[11] == '+') &amp;&amp; (buffer[19] == 0xAE)){
     //Calculate the checksum
      uint16_t cs2 = 0;
   for (uint16_t i = 6; i &lt; 18; i++){
    cs2 += buffer[i];
    }
    //if the checksum matches....
    if(cs2 == buffer[18]){
      //Send the byte to serial port three
      Serial3.write(buffer, count); 
  }
  }

 }
}

 if (Serial3.available()){
    for(count=11; count&lt;20; count++){
      buffer[count] = Serial3.read();
      //Send the byte to serial port three
      Serial.write(buffer, count); 
     }
 }
</code></pre>

<p>}</p>
 13432: <blockquote>
  <p>My question here is how can I simultaneously read out all the data from the different serial ports on the arduino mega sketch.</p>
</blockquote>

<p>As you are using several serial ports data can already be received simultaneously. Each serial software class (Serial1, Serial2, Serial3) has an internal buffer where data is stored until it is read. </p>

<p>You only need to read the data before the internal buffers are filled and there is a risk for over-flow. Check that data is available and read as usual per serial port. Avoid any blocking calls to avoid buffer over-flow. </p>

<p>Cheers! </p>
