I am currently workng on a peoject that requires serial communication between PIC 24FV16KA302 and a PC software.

I have searched the internet for the past 3 days and i cant find an answer for my proble so i decidet to ask here . This is my first visual studio program so i dont have any expirience with the software.

The PIC has few variables and two 8x16 tables that i need to view and modify on the PC side . The problem comes when i send the tables , all other information is received without a problem . I am using serial connection ( 38400/8-N-1 ) via uart to usb converter FT232

When the PC send "AT+RTPM" to the PIC .

Code:
Button7.Click
    SerialPort1.ReceivedBytesThreshold = 128
    MachineState = MS.Receive_table
    SerialPort1.Write("AT+RTPM")
End Sub
The PIC sends back 128 Bytes( the values in the table )

Code:
case read_table_pwm : // send pwm table 
        for (yy = 0 ; yy < 8 ; yy ++) {
            for (xx = 0 ; xx < 16 ; xx++ ) {
                uart_send_char(controll_by_pmw_map_lb[yy][xx]) ;
            } 
        }
           at_command = receive_state_idle ;
    break ;
Which the software is suppose to get and display in a DataGrid.

Code:
Private Sub SerialPort1_DataReceived(sender As Object, e As IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
    If MachineState = MS.Receive_table Then
        SerialPort1.Read(Buffer_array_received_data, 0, 128)
        cellpos = 0
        For grid_y As Int16 = 0 To 7 Step 1
            For grid_x As Int16 = 0 To 15 Step 1
                DataGridView1.Rows(grid_y).Cells(grid_x).Value = Buffer_array_received_data(cellpos)
                cellpos += 1
            Next
        Next

End Sub
The problem is that most of the time ( 99 % ) it displays only part of the dataset and zeros to the end , and when i try to do it again it display the other part and it starts from the begining .

First Try:
Name:  part1.jpg
Views: 168
Size:  23.5 KB
Second Try:
Name:  part2.jpg
Views: 158
Size:  25.8 KB

If i try the same thing with another program i allways get the full dataset

Name:  Realterm.jpg
Views: 161
Size:  45.8 KB
Name:  termite.png
Views: 158
Size:  31.5 KB

I have tried doing it cell by cell , but it only wors if i request them one very second , other wise i get the same problem .

After that i need to use a timer ( 100 ms ) to request live data from the PIC . this work better but still some of the time i get some random data. I havent focused on that for the moment because without the dataset everything else is useless .

Am i missing something , has anyone encountered the same problem .