I thought your initial problem was unable to receive return data correctly and steadily? Was it solved?
"现在还是不能做到发送命令与接收数据的同步" Is this your another problem? How do you want it to be "发送命令与接收数据的同步"? If you do not send the command first, how do you expect the return bytes?
May I suggest that you build the VISA Write and Read code into sub-VI, and call it for each event case.
Hi, as suggested, you might want to build the VISA write and read portion into a sub-VI. Then, at each event case, call the sub-VI once.
Please verify with HyperTerminal on each Command sent (including if there is any Termination Character), expected time delay after command is sent (i.e. the closure of the gate may take some time?), and expected no. of return bytes etc.
I am only able to help in suggesting possible ways of VISA Write/ Read. As for the verification on the Command(s), Termination Character, Return Bytes etc, I'll leave it to you, since I am not able to see your actual system running.
Please perform some code debug (highlight execution), and I am sure you can achieve!