LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA write problem

Solved!
Go to solution

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

0 Kudos
Message 1 of 10
(5,038 Views)

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

0 Kudos
Message 2 of 10
(5,031 Views)

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

0 Kudos
Message 3 of 10
(5,012 Views)

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!

0 Kudos
Message 4 of 10
(5,002 Views)

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

 

0 Kudos
Message 5 of 10
(4,997 Views)
Solution
Accepted by LVCoder

Please look on this Post on LAVA:

http://forums.lavag.org/index.php?s=&showtopic=12116&view=findpost&p=52832

 

Eugen

Message Edited by Eugen Graf on 10-20-2008 08:38 AM
Message 6 of 10
(4,988 Views)

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?

 

0 Kudos
Message 7 of 10
(4,977 Views)

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

0 Kudos
Message 8 of 10
(4,960 Views)

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.

Message 9 of 10
(4,957 Views)

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

 

0 Kudos
Message 10 of 10
(4,928 Views)