Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible for multiple read and write sessions with a VISA?

Here is my problem. I have a serial device. I am writing and reading from it at the same time using two loops.
Take a look at given Vi. It may not work at ur side. But figure out what is the error.
The thing is when the loops finish only one of the array has the data. They sometimes alternate.
Funny thing is when i  run  with 'Highlight execution' option, the loops show data being read, but can't put read data into their arrays.Smiley Surprised
Maybe the the simultaneous read and write might be problem. But in a case where i am not doing this simultaneously the same problem occurs.
----------------------------------------------------------------------------------
I have still not got what I love.....
0 Kudos
Message 1 of 14
(4,976 Views)

No, you can't run both of the for loops in parallel. It really does not make any sense to even try to do this

Don't understand your comment about 'only one of the array has the data'. You don't have any array at all for the data. All that you have is a tring indicator and that will just show the results from the very last read.

0 Kudos
Message 2 of 14
(4,963 Views)
Sorry, I must have removed the arrays. Anyway, I know it doesnot make any sense.
But, there is another VI where I have a 'event case' which registers all the key presses.
Then for each key there is a 'case structure' which has read or writes.
So, there is no possibility for simultaneous reads or writes. Even then I am not getting reading properly.
Write is working properly. But there is case where I write a command for querying and then read from the instrument buffer. There is the problem.
Help. Take a look at the VI.
----------------------------------------------------------------------------------
I have still not got what I love.....
0 Kudos
Message 3 of 14
(4,947 Views)
What exactly is the problem? I don't understand why you've written the VI the way you did. Why don't you simply put the external case statements inside the event? What is the purpose of the command arrays and your indexing scheme? How do you want it to work? I don't see how you can simply choose a specific function/range without going through a lot of unnecessary steps.
Have you looked at the Instrument Driver Guidelines? Lastly, why do you use so many local variables? You don't need to use any at all.
 
 
0 Kudos
Message 4 of 14
(4,921 Views)
Dennis, if I am writing to single indicator from more than one place then what should I use. Should I wire the data from all the places. You tell me how to do it and I will be glad to learn.
The external case structures are to be run all the time.
The command arrays are to be used when I press a key the case structures should extract the commands in rotation with respect to their own cases.

Finally, I did not understand these,

I don't see how you can simply choose a specific function/range without going through a lot of unnecessary steps.

Have you looked at the Instrument Driver Guidelines? What for?
----------------------------------------------------------------------------------
I have still not got what I love.....
0 Kudos
Message 5 of 14
(4,903 Views)

You've got the indicator/local inside the case statement. You just need to move outside as shown below.

Also shown below is a way to directly select a function and skip the string indicators. I don't see the point in having a boolean and cycling through the functions (or cycling through anything for that matter). Use a ring control or enum and the fucntuon can be directly chosen and with the text shown in the ring/enum, you don't need the string indicators at all.

The instrument driver guidelines and the instrument wizard would have shown you more effective ways to interface to an instrument.



Message Edited by Dennis Knutson on 04-21-2008 07:44 AM

Message Edited by Dennis Knutson on 04-21-2008 07:46 AM
0 Kudos
Message 6 of 14
(4,870 Views)
No Dennis. I have VI which should select the commands when ever I press the relted button. Something like if I press function button again and again the the case should select the command in the command array and increment If pressed again and access the next command and then start all over again.
And also I still have to write into a single indiactor from many places with different data. So local variable is the only thing, I think.
----------------------------------------------------------------------------------
I have still not got what I love.....
0 Kudos
Message 7 of 14
(4,846 Views)
Sorry that should be 'related button'. Also, how do I edit my own  post?!
----------------------------------------------------------------------------------
I have still not got what I love.....
0 Kudos
Message 8 of 14
(4,835 Views)

I know exactly what you are trying to do but I don't understand why. You have a function button that needs to be repeatedly click in order to change the function on the instrument. You are just making it more difficult for the end user, imho. If you were to follow my recomendation and the instrument driver standard, you would be able to select any function randomly and with a single change of a ring control. with your method, it would take 6 button clicks to go from dc current to dc volts. With the standard technique, only one.

And no again, if you write your code correctly, you do not need any local variables. I will repeat my statement that the only reason you have local variables is because you have placed the local/indicator inside the case statement. This is absolutley unnecessary. Look at what I posted. You might also want to check out some of the free resources for basics LabVIEW training at http://www.ni.com/academic/lv_training/how_learn_lv.htm.

0 Kudos
Message 9 of 14
(4,822 Views)
Ok, ok I got it. Smiley Happy. Dennis babu(In India babu: means friendSmiley Very Happy) thanks. Sorry about the Latency of my brain! Also, thanks for the link.
Yeah I know that function would have been much better with ring control.
Also, what is 'imho'?

@Dennis Knutson wrote:

 You are just making it more difficult for the end user, imho.






----------------------------------------------------------------------------------
I have still not got what I love.....
0 Kudos
Message 10 of 14
(4,802 Views)