01-18-2013 10:39 AM
I want to execute my vi slowly as it run in normal space it doesnt run properly .
It works fine when i run it with highlighter on.
Whats should i do to slow the pace of the execution?
01-18-2013 10:47 AM
Are you running this VI with the Run Continuously button? Do not do that. You should have a while loop. Based on what I can see, I would suggest using an event structure inside of a while loop. On the Boolean value change event, send your command and read the response. Also have stop button with an event case to stop the while loop.
The reason for this is that you should only setup your port once at the beginning of your program and close it once at the end. If you are using the Run Continuously button, you are opening/configuring and closing your port constantly. This is bad.
Also, you will want to add a small delay between when you send your command and when you read the response.
01-18-2013 10:50 AM
What you need is a delay between the write and the VISA Bytes at Serial Port. That wait you have in there does nothing to give the instrument time to respond. However, since it appears that you are sending a termination character after the 'Ver' command, you should probably set the VISA Configure Serial Port to use the same termination character and not use the VISA Bytes at Serial Port at all. The VISA Bytes at Serial Port and a delay is usually just a hack that can be eliminated with more elegant programming. With a termination character enabled, you specify some high byte count and the read will wait until the character is detected and then automatically terminate. With a delay, you'll be constantly fiddling with it to find the correct time to wait or have a delay that is too long and just wasting time.