Task is very simple, I need to use VB to read call a machine on the display of measurement results, use a GPIB turn USB interface thread connection machine and computer, the root on the manual of tieline provides a serial port to read data from machine 2 orders, one is to read eoi this command will only read a value, the other is to read has been read from the machine, is theoretically I send into the serial port read eoi (SerialPort. Write (" read eoi ")) will read machines that display the current value, and then I assigned to a variable or can be in to the textbox, task to complete, but now there's a bug, such as the machine now has a measurement value of 1 v, I use the read eoi read it many times instead of 1 v on a stored in machine registers the value of X, I will always read it with the read, and read the first value is X, after the second value and the value is 1 v, this time I disconnect a serial port connection, reoccupy read read eoi is 1 v, then change the measured value, use the read eoi is always read 1 v, because at that time in machine registers a value of 1 v, unless I use read read it again, and then use the read eoi, they can read the current value, that is to say, only with the read can refresh the value of the machine in the register
Machine is too old, had this bug after also nobody will fix, so only from the aspects of programming to find a way to, there are three solution to imagine that one is I create a background window, each read before a number in the run on a read, then close and open the serial port, serial port to send the read eoi so you can read the current value every time, but sometimes to read hundreds of number and average from the machine, use this method to close open serial port hundreds of times, want to ask you is there any method can continuously open serial port, disconnect the read action, I tried all sorts of interrupts are not ok,
Can the second idea is to use VB to write a similar to the read command, tieline provide read-only fixed number, then I need use regular expressions to screen out the numerical, does this need to know the various parameters of this wire?
Can the third assumption is that, using VB to write a function to refresh machine registers, let it not save every time on a value, real-time transfer current measurements?
If above all cannot achieve, any solution can recommend for you
Question is more complex, said may also is not very clear, but still hope can anyone can help me, thank you very much
CodePudding user response:
In addition to "read data", still should have other instructions!Did you look at the "register" instruction...
CodePudding user response:
Other instruction has seen, no such instructionsCodePudding user response:
If it is, I use the first method,CodePudding user response:
Don't use MSCOMM?MSCOMM can set the connection is broken, and then sends the appropriate read command,