I am trying to connect a pressure device to my PC and the way I am doing it is by using the serial VI's (I am using serial - RS232- port to connect). I have based the code (see attached) on a few pre-made VI's that came with the device, but I am trying to modify it for our specific purposes.
The problem that I am having is that the VI doesn't always work. Sometimes it will perform the desired action (i.e. change the units), and sometimes it will not. In other instances, it will execute only the third "VISA write" VI (change set point), and sometimes it doesn't do anything (I am wondering if I cannot put multiple VISA Write VI's sequentially like I have, or if I need a "VISA read" VI or something like that. Anyways, would anyone know the reason why this may be happening? I know the question is a little bit vague but the problem is as well haha, but basically the code that you see attached does not work (sometime it even crashes). Let me know if there is anything else I can further clarify!
why do you close the port right after sending those commands? This may "kill" the write buffer even before the port had a chance to send the first bytes…
Why don't you use the VISAInitSerialPort function?
And why don't you use AutoCleanup?
I have used the VISAInitSerialPort function already, and also without the close vi at the end, and still it won't work. I have tried separating each command (deleted the others) and when I do that, all the commands work, it's just when I put them sequentially that they do not execute properly.
Have you tried putting a small delay between each write command? Maybe if the device receives commands too fast, it overloads it because you didn't give it enough time to process the first commands.
Can you please send me this VI? I'm facing the same problem trying to contact this device, thank you