Send data from Visual Studio to Arduino Mega

Hi,
I have a project to connect visual studio and arduino. Here I use arduino mega2560.
I want to send data from visual studio to arduino with serial comm. Data length is 350bytes.
But when I read in the arduino series, the data is not finished yet. Data length under 65 bytes.
Why? And how to solve it?

The Arduino has a limited amount of RAM so the serial receive buffer is not that big.
From the HardwareSerial.cpp...

// Define constants and variables for buffering incoming serial data.  We're
// using a ring buffer (I think), in which head is the index of the location
// to which to write the next incoming character and tail is the index of the
// location from which to read.
#if (RAMEND < 1000)
  #define SERIAL_BUFFER_SIZE 16
#else
  #define SERIAL_BUFFER_SIZE 64
#endif

The simple but worst/less desirable option is you can either increase the buffer size in the core to allow for your data size or a better option would be to send the data in packets that are acknowledged by the Arduino before sending the next packet.

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

In the examples the array size is set to 32 characters but you can extend that as you wish by changing the value of numChars.

Because the code empties the 64 byte serial input buffer before it can fill up the buffer size does not impose a limit.

...R

I want to send data from visual studio to arduino with serial comm

Not going to happen. Visual Studio has no means to connect to a serial port.

An application written using Visual Studio CAN connect to a serial port, but that is NOT the same as Visual Studio connecting to the serial port.