12-08-2016 01:57 PM
Hi I am trying to read from an unit using following VI (screen shot attached). For the first loop, I end up reading the previous value from the unit. I am expecting that after trigger (T command through VISA write) and then read (VISA read) should return me the current value. the time delay is 200 ms second before read as mentioned in the manual. What is going on?
12-08-2016 02:04 PM - edited 12-08-2016 02:05 PM
12-08-2016 02:07 PM
You are sending two commands, "N5" and "T". Do each return a repsonse? You are only reading 1 response right after you send the "T". If each sends a response, then every iteration you are receiving 2 responses, but only reading 1, probably the response to the "N5" command.
12-08-2016 03:33 PM
I tried flush IO buffer before sending the write command (N5). Also, replaced the CLR with flush IO buffer. So I have two flush IO buffer, in begining and after read, is that the way you suggested? Also, I am not sure about the mask option in flush io function. I tried all options but nothing works.
12-08-2016 03:35 PM
N5 command do not return a response, only T return a response.
12-08-2016 03:55 PM
Where is the manual?
If you are writing 2 commands, only 1 is responding, and you are reading 1 time, you should not be having a problem. And if you are clearing the buffers before writing, you certainly should not be getting stale data.
Are you sure your device is working right? How do you know it is returning a previous value and not a new value that just happens to be the same?
12-08-2016 04:07 PM
I am changing the magnetic field in every while loop and for that there is a corresponding voltage on the unit i am trying to read. So when i am running 0 to 3 loop, my i = 0 loop returns the last value (volts measured by the unit), for my i=1 loop, i am getting value that suppose to be measured for loop 0..and so forth. so when i am running n loop, my reading is for n-1 loop.
I dont have real manual, this unit is part of a mass spectrometer control unit without any technical support. I reverse engineered the commands through source code given for the old software written in Modula 2.
12-08-2016 06:54 PM
If you are sending a command and then reading a response, perhaps it takes some time for the device to act on the command you sent it.
Try putting a wait delay between the commands.