10-20-2008 01:32 AM
Dear all,
I am trying to write 2 bytes to VISA on a button click.
My instrument when recieves those 2 bytes sends some data.
I am using "byte array to string" to write those 2 bytes to VISA.
thing is when i click the button really slow(say, at a gap of 1 sec) it works fine. but i click the button really fast, it hangs and finally shuts down LV.
Is there any better and faster way to write data to instrument ?
Thanks,
Ritesh
Solved! Go to Solution.
10-20-2008 02:34 AM
Hi Ritesch,
if you expect a response, then you have to wait for it. How fast do you need to write your data to the instrument?
Mike
10-20-2008 07:32 AM
Hi MikeS81,
i am attaching my Vi here.
I just want the data to send across to my instrument just on a button click.
I get an error stating "timeout expired before operation completed".
The error might be because i am reading and writing into VISA in different loops.
Pls have a look at the vi has let me know if you could make out where the problem is .
Thanks,
Ritesh
10-20-2008 07:55 AM
Hi Ritesh!
Why are you using three parallel loops? Two of them are reading VISA and one writing, but you can't read the same interface in two parallel loops.
For simultaneously reading and writing you have to open VISA twice! So you will get two independant VISA Refnums to one interface!
10-20-2008 08:04 AM
Hi Eugen,
my hardware has 2 buttons on it. One button(on trigger) sends 1054 bytes and the other sends 62 bytes.
to differentiate between the two data, i am reading from VISA in 2 different loops.
And there is a button on the front panel, which when clicked sends 2 bytes to the H/W. when the H/W recieves those 2 bytes, it sends 1054 bytes of data.
I am not getting any problem when the buttons on the H/W are triggered. Only when the front panel button(Capture) is clicked, it gives an error.
this is the aim of the Vi.
could you pls post a sample vi showing how to open the VISA twice to get the work done more efficiently?
Thanks,
Ritesh
10-20-2008 08:38 AM - edited 10-20-2008 08:38 AM
Please look on this Post on LAVA:
http://forums.lavag.org/index.php?s=&showtopic=12116&view=findpost&p=52832
Eugen
10-20-2008 08:50 AM
But say me please what should your programm do if your upper loop waits on 1054 bytes or is reading data and the middle loop gets DSR Event and want to read data too?
10-20-2008 09:29 AM
Hi Eugen,
I tried with duplicate sessions also. But still i am getting the same error if i write data to VISA at very short intervals.
I am attaching the new Vi with duplicate sessions.
Just see if there's anything i could change in that to resolve the error.
Thanks,
Ritesh
10-20-2008 09:35 AM
You didn't activate "Duplicate Session" Flag, but it should be not the problem.
I think your problem is the software driver of your serial Interface. It's a USB-Serial converter? Which OS do you use?
I have had problems with Profilic USB-Serial converters and VISTA. I got always blue screen if many data was read or write.
10-21-2008 02:25 AM
Hi Eugen,
Duplicate Session was the problem.
When i set that flag to TRUE, it started working properly.
Eugen Graf wrote:It's a USB-Serial converter? Which OS do you use?
I have had problems with Profilic USB-Serial converters and VISTA. I got always blue screen if many data was read or write.
My device has RS232 interface. and i am using WinXP SP2.
I dont think there's any problem with the Device divers as i never got a blue screen as you used to get. Rather i used to get the problem in the VISA Write function.
and now that is also resolved.
Thanks,
Ritesh