06-19-2014 05:40 PM
I am using an RS232 to control an older model Power Supply (OXFORD PS 120-10).
I have successfully written several VI's that all work, the only problem is that VISA Read takes WAY too long. I'm talking 10's of seconds to refresh. I need it have it refreshing in milliseconds or at least tens of seconds for the measurements we need. All of the VI's I have written have the same timing issue.
Attached is the most basic Serial Read/Write VI. Is there any way to improve the Read rate? Or might this just be an instrumentation issue. The strange thing is the Write commands work almost instantaneously (I can seem them on the instruments display).
Please help if you can, I've only been working with LabVIEW for a few weeks and am very must still in the learning process.
Thanks!
Solved! Go to Solution.
06-19-2014 06:32 PM
Do you have the communications protocol for the power supply? If you do not have everything right, you will have problems with communications.
Tens of seconds is a clue that you may be getting timeout errors because the default timeout is 10 seconds. Try placing an inidicator on the error out wire inside the loop (after Read) to see if an error occurs on any iteration. The way you have the VI set up you only see the error on the last iteration of the loop.
You are writing a carriage return to the instrument. If it requires that, it almost certainly sends a carriage return with the response. (This is why I asked about the protocol). If the instrument sends a carriage return (or other termination character), then you should Enable Termination Character on the Configuration VI and set the termination character to the correct value. The default is line feed (hex A or decimal 10). A carriage return is hex D or decimal 13. You must wire the numeric value to the termination character input for any value other than the default. Then change the byte count value (at the Read input) to a number larger than the longest message the instrument will ever send, perhaps 100 or 500. The Read will end as soon as the termination character is received, regardless of the number of characters.
I suspect that this is the problem - the instrument sends fewer than 10 characters in most messages but does send a termination character.
Lynn
06-19-2014 06:42 PM
I don't have LabVIEW right now, so I can't look at your code. But here's what I would look for.
10 seconds for a VISA read to happen sounds like you ran into a timeout situation. Are you getting any errors out of your VISA Read?
Does the power supply use a termination character? If it is using ASCII commands, they usually do. If it does, make sure you enable the termination character and set the bytes to read to something rediculously high. The VISA Read will stop when the termination character is found.
06-20-2014 11:38 AM
I placed an error indicator immediately after the Read and it does seem to be a timing issue. The error code I recieve is -1073807339 which states: VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.
I enabled the termination character which according to the manual is Carriage Return. I also tried lowering my timeout rate to 100ms, then 50 ms, and it refreshes according to those times.
How does the timeout affect the running of the code, and will this cause issues when I run the instrument in more complicated codes?
Thanks again
06-20-2014 12:10 PM
06-20-2014 12:13 PM
06-20-2014 12:42 PM - edited 06-20-2014 12:42 PM
Thanks everyone. Jeff- The mod worked wonderfully. I implemented it in several of my other more complecated codes already. And Dennis, the explanation was very helpful for my understanding of how Serial communication works.
Thanks again!