noel_t
Junior Member level 3
View attachment VB.rarIn fact, I am working on a project ( Data Acquisition system for Solar Panel) which collects all the data (from the sensors e.g. light, temperature, voltage, current) and after processing by Microcontroller (PIC Microcontroller) will display them on the LCD. It is also required to show/display these Four (4) parameters in the computer screen.
Therefore, as per need of the project, I selected Visual Basic to do it for me.
I have already completed the interfacing part (All the necessary codes-C Language for transmitting data from PIC to the UART-USB), and it is successfully transmitting data to the computer.( It is tried by LABVIEW)
What I need is to configure my VB file to receive the data from USB and show it on the specified textbox( which is designed by VB).
Since I have not done the VB design and my friend helped me to do it, I am having some difficulties by working with it. I am getting errors and the measured values which supposed to be displayed in the defined text box can not be showed.
Please help me to eliminate the errors and give me your advice on how I can establish the communication between the VB and Microcontroller.
Here are the errors I am getting.
--------------------------------------------------------------------
I get this error “Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex”
' Text display routine, which appends the received string to any text in the Received TextBox.
Private Sub Display()
Temperature.Text = New String(stringtoparse, 1, 5)
Light.Text = New String(stringtoparse, 6, 5)
Volt.Text = New String(stringtoparse, 11, 5)
Current.Text = New String(stringtoparse, 16, 5)
------------------------------------------------------------------------
Therefore, as per need of the project, I selected Visual Basic to do it for me.
I have already completed the interfacing part (All the necessary codes-C Language for transmitting data from PIC to the UART-USB), and it is successfully transmitting data to the computer.( It is tried by LABVIEW)
What I need is to configure my VB file to receive the data from USB and show it on the specified textbox( which is designed by VB).
Since I have not done the VB design and my friend helped me to do it, I am having some difficulties by working with it. I am getting errors and the measured values which supposed to be displayed in the defined text box can not be showed.
Please help me to eliminate the errors and give me your advice on how I can establish the communication between the VB and Microcontroller.
Here are the errors I am getting.
--------------------------------------------------------------------
I get this error “Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex”
' Text display routine, which appends the received string to any text in the Received TextBox.
Private Sub Display()
Temperature.Text = New String(stringtoparse, 1, 5)
Light.Text = New String(stringtoparse, 6, 5)
Volt.Text = New String(stringtoparse, 11, 5)
Current.Text = New String(stringtoparse, 16, 5)
------------------------------------------------------------------------