A
Abdurrahman YAMAN
Guest
Hi,
I am trying to develop an 6 channel oscilloscope using vb.net and PIC microcontroller. I had solved receiving "string" data thtough serial but for improving sample rate i have to take data as binary.
So, i am receiving data using microC serial monitor like that,
0b01000001 0b11111110 0b00000011 0b11111110 0b00000011 0b11111110 0b00000011 0b11111110 0b00000011 0b11111110 0b00000011 0b11111110 0b00000011
First byte is header which is letter "A" then i received low byte then high byte over ADCs of microcontroller there are 6 different ADC values.
My first problem is that when i tried to get values i can get output like this "A?". I have to revieve like above.
Last problem is i don't know how can i split bytes into 6 different pieces.
Here is my code;
:code:
Private Sub SerialPort1_DataReceived(sender As System.Object, e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
ReceivedText(SerialPort1.ReadExisting())
End Sub
Private Sub ReceivedText(ByVal [text] As String)
If Me.RichTextBox1.InvokeRequired Then
Dim x As New SetTextCallback(AddressOf ReceivedText)
Me.Invoke(x, New Object() {(text)})
Else
Me.RichTextBox1.Text &= ([text])
End If
End Sub
:code:
When i use string method. Ican split values according to their header which is "A,B,C,D,E,F". But this type of communication too slow for me. I have to improve my sample rate.
Thanks a lot.
Abdurrahman
Continue reading...
I am trying to develop an 6 channel oscilloscope using vb.net and PIC microcontroller. I had solved receiving "string" data thtough serial but for improving sample rate i have to take data as binary.
So, i am receiving data using microC serial monitor like that,
0b01000001 0b11111110 0b00000011 0b11111110 0b00000011 0b11111110 0b00000011 0b11111110 0b00000011 0b11111110 0b00000011 0b11111110 0b00000011
First byte is header which is letter "A" then i received low byte then high byte over ADCs of microcontroller there are 6 different ADC values.
My first problem is that when i tried to get values i can get output like this "A?". I have to revieve like above.
Last problem is i don't know how can i split bytes into 6 different pieces.
Here is my code;
:code:
Private Sub SerialPort1_DataReceived(sender As System.Object, e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
ReceivedText(SerialPort1.ReadExisting())
End Sub
Private Sub ReceivedText(ByVal [text] As String)
If Me.RichTextBox1.InvokeRequired Then
Dim x As New SetTextCallback(AddressOf ReceivedText)
Me.Invoke(x, New Object() {(text)})
Else
Me.RichTextBox1.Text &= ([text])
End If
End Sub
:code:
When i use string method. Ican split values according to their header which is "A,B,C,D,E,F". But this type of communication too slow for me. I have to improve my sample rate.
Thanks a lot.
Abdurrahman
Continue reading...