LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP "VISA Read" blocks "VISA write"

Hello,

 

I am trying to communicate my system by a TCP/IP connection using VISA. I have two vi's running in parallel.

 

The first one reads messages received and enqueues. [ VISA read with a timeout of 2 seconds]

 

The second one sends a message and waits the answer from the queue where the first VI puts the messages.

 

I can see a timing problem. When the first VI is reading (with a timeout of 2 seconds), the second one can not send anything. So, if "sender" VI sends one command per second, "VISA Read" makes a sample time of 2 seconds (timeout).

 

Maybe I have not explained very well my system, but my question is: is there any way to make VISA write/read functions at the same time ?

 

[I know my problem will be solved decreasing the read timeout]

 

Thanks you

0 Kudos
Message 1 of 4
(3,443 Views)
What are you reading/writing? Is it the same instrument? If so, what is the instrument? Instruments will typically send data only after you have written a query to it so you have to sequentially do a write and then a read.
0 Kudos
Message 2 of 4
(3,408 Views)

Dennis Knutson wrote:
What are you reading/writing? Is it the same instrument? If so, what is the instrument? Instruments will typically send data only after you have written a query to it so you have to sequentially do a write and then a read.

I have found that the VISA read and write VIs do not allow parallel processing. Once it is waiting for either the read or the write the other Vi is blocked. This has been confirmed with NI. The work around that we use is to have a state machine that will switch between the read and write operations. The write functions are driven by a queue and the read operations post all data to a queue for a parallel task to process.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 4
(3,390 Views)

Escrito por Mark Yedinak:

Dennis Knutson wrote:
What are you reading/writing? Is it the same instrument? If so, what is the instrument? Instruments will typically send data only after you have written a query to it so you have to sequentially do a write and then a read.

I have found that the VISA read and write VIs do not allow parallel processing. Once it is waiting for either the read or the write the other Vi is blocked. This has been confirmed with NI. The work around that we use is to have a state machine that will switch between the read and write operations. The write functions are driven by a queue and the read operations post all data to a queue for a parallel task to process.


 

Dennis: I read and write ASCII messages. But the instrument does not only send me answers of my commands. It sends me also asyncronous messages. So I have to read with a "while" if there is any new message and enqueue the messages received. By other way, I send my commands and wait the answer. The problem is, if I wait for a 5 seconds with "Read VISA" I can not send any command, because "Write VISA" is blocked these 5 seconds.

 

so, Mark, I think you have answered my question. "Read VISA" blocks "Write VISA" when it has a timeout.

 

Thanks you!!

0 Kudos
Message 4 of 4
(3,382 Views)