lloydi12345
Member
Hi, I'm having problem in uart communication. The set up here is that I'm doing half duplex communication. When I click a command button, it will send a character and the PIC also will send the same character back to VB6. There's no problem in communicating from vb6 to pic because I am just sending single characters (which I think is not advisable) to be compared in the if/case statements inside the pic. For example, If I click a command button then it send "x" letter/character to the microcontroller through the MScomm1's abilities then the microcontroller checks if the character received is "x" then it will do a specific function for the "x".
Here's a sample piece of my code:
The problem is when the microcontroller sends the data to VB6. It is continuous.
When the PIC sends back "x" to Vb6 the textbox shows "x". When I click the command button again it goes "xx" then "xxx" and so on until many x are placed on my textbox.
I have something like this on my vb6:
I would like also to have case select statements or if statements on my VB6, but I can't compare them with these continuous data sent. I can't make it like
Do you know what's the best way to interact PIC and VB6?
Here's a sample piece of my code:
Code:
case 'x':
uart1_write_text("x"); <-- sends back data to VB6
delay_ms(100);
break;
The problem is when the microcontroller sends the data to VB6. It is continuous.
When the PIC sends back "x" to Vb6 the textbox shows "x". When I click the command button again it goes "xx" then "xxx" and so on until many x are placed on my textbox.
I have something like this on my vb6:
Code:
Private Sub Timer1_Timer()
Text2.Text = MSComm1.Input & Text2.Text
End Sub
I would like also to have case select statements or if statements on my VB6, but I can't compare them with these continuous data sent. I can't make it like
Code:
if textbox.text = "x" then
do this
else if textbox.text = "xx" then
do this
else if
Do you know what's the best way to interact PIC and VB6?
Last edited: