Hi, there are many possible ways to transmit/receive and display your data, for simplicity and hopefully so you will see some immediate results you can try the following.
The first thing is to ensure that the data from the Pic is formatted exactly how we want it for this test. I'm not a C programmer but you can perhaps figure our exactly what is required from this. The objective is to transmit 5 data strings with a space character between each and finally the newline. The newline character (binary value 10) is important because that is the default value the Visual Basic ReadLine instruction looks for as a termination character. If the Newline character is not suitable for your purpose then it can be modified, eg. SerialPort1.NewLine=somecharacter
Code:
printf("%f %f %f %f %f \n",dat1,dat2,dat3,dat4,dat5);
The VB code uses the DataReceived event handler to detect data arriving at the ports input buffer, the timeout is there to give 100 mS for a valid string to arrive and help prevent the application from hanging. Once the string is read by the SerialPort1.ReadLine it is passed as a parameter to the delegate Show_sData. This sub routine uses Split to split the sData string into an array of 5 smaller strings using the spaces between data as the delimiter then each string in the array is displayed in its respective text box.
Code:
Private Delegate Sub mydel(ByVal s As String)
Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Dim sData As String = ""
Try
SerialPort1.ReadTimeout = 100
sData = SerialPort1.ReadLine()
Me.Invoke(New mydel(AddressOf Show_sData), sData)
Catch ex As Exception
End Try
End Sub
Private Sub Show_sData(ByVal s As String)
Dim valArray() As String
valArray = s.Split(" ")
TextBox1.Text = valArray(0)
TextBox2.Text = valArray(1)
TextBox3.Text = valArray(2)
TextBox4.Text = valArray(3)
TextBox5.Text = valArray(4)
End Sub