Let me assume that the data are coming over the serial port as ASCII characters with a preamble data byte (say: 0x03) and a postamble data byte (',' = comma = 0x2C). The possible solution to retrieve the decimal numbers from the received frame is (tested using MEGA as sender and NANO as receiver using soft serial ports):
MEGA (sender codes):
#include<SoftwareSerial.h>
SoftwareSerial SUART(10, 11); //SRX = 10, STX = 11
char myData[] = "200,0,0,1234,567,890,1000,2000,3000,4000,5000";
void setup()
{
Serial.begin(9600);
SUART.begin(9600);
}
void loop()
{
SUART.write(0x03);
SUART.print(myData);
SUART.write(',');
//------------------
delay(1000);
}
NANO (receiver codes):
#include<SoftwareSerial.h>
SoftwareSerial SUART(10, 11); // SRX = DPin3, STX = DPin - 4
bool flag = false;
char myData[10];
byte counter = 0;
int intData[11];
void setup()
{
Serial.begin(9600);
SUART.begin(9600);
}
void loop()
{
byte n = SUART.available();
if (n != 0)
{
if (flag = false)
{
byte x = SUART.read();
if (x == 0x03)
{
flag = true; //received preamble code: 0x03
}
}
else
{
do
{
byte m = SUART.readBytesUntil(',', myData, 10); //receive/store every data item separtaed by comma
myData[m] = '\0'; //nul charcater
intData[counter] = atoi(myData); //retrieve original decimal number
Serial.println(intData[counter]);
counter++;
}
while (counter != 11);
flag = false;
counter = 0;
}
Serial.println("========================");
}
}
Screen shot (NANO):

