Home > Software engineering >  Vb serial communication
Vb serial communication

Time:09-30

Everybody is good? Using VB6 own serial port control to develop a small program, receiving data from the workshop equipment (count), and stored in the network database, before in my computer (main board with a serial port) to run on this small program, there is no problem, return the data can be received and saved to the database, but when the program transplant to another computer (the computer did not bring a serial port, is through a USB transfer 232 adapter receiving return data), the problem goes something like this: with serial assistants or in the condition of using breakpoint debugging VB6 can receive return data and run normally, but if the compiler to run the program, can't receive the correct data (the code is a statement by to pick up and save the data, if the returned data format conforms to the requirement of judgment statements, receiving and preservation of the following statements should be executed, but at this moment is not executed),
Say so many, I think the problem is now on the returned data format, own a serial port can return data correct format; But not a use of switching equipment, I don't know if each master have met this kind of situation, help me to judge it, whether this problem? Or I have a question of program statements,
Online urgent! Thank you for your attention!

CodePudding user response:

Use serial port controls, and then judge the received data stream in a serial port interrupt,
But didn't see the code specific issue also is bad to say,

CodePudding user response:

reference 1st floor zaxife response:
use serial port controls, and then judge the received data stream in a serial port interrupt,
But didn't see the code specific issues also say that


Boss, I can't see I have said above, using VB is bringing a serial port control, in the event of an MSComm_OnComm for judging

CodePudding user response:

refer to the second floor SDRCZHT response:
Quote: refer to 1st floor zaxife response:

Use serial port controls, and then judge the received data stream in a serial port interrupt,
But didn't see the code specific issues also say that


Boss, I can't see I have said above, using VB is bringing a serial port control, in the event of an MSComm_OnComm data judgment.


Er, inside the window you add a text box displays the received data flow don't know what's the problem? Such a simple since the test have never done?

CodePudding user response:

In the another computer step through too?

CodePudding user response:

Own PC COM port C is duplex, with Usb transfer the COM is simplex, unable to receive when sending, receiving when unable to send, and the transformation takes time,

CodePudding user response:

Delay time is obviously not enough, or you have a handling problem, serial transmission rate compared with your code execution efficiency is obviously much slower, add breakpoint to result in your application, but does not affect the serial data receiving, from interruption to resume this paragraph of time serial data reception is complete, so running normally, without interruption, no delay this time, a serial port data haven't receive you read cache, obviously read out the result is not correct, can not run normally that's not necessarily as a result,

CodePudding user response:

Install again VB, may lack documents
  • Related