From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Write and Read taking a long time in-between Loops

Hi All,

 

So I'm having a really basic issue here, VISA Write and Read are taking a long time in-between loops. Setup: I am communicating with a Keithly 6485 Picoammeter using LabView, using a NI USB to GPIB adapter cable, using SCIP (488) commands.

 

Here's the measurement goal. Take 100 measurements, send them over, save them, rinse and repeat.

 

I mean the code is stupid simple at this point. The VI sets up the meter, Writes 'take a measure', then Reads the measurements sent, and then Loops over 'take a measure' and Read.

 

HERE'S THE PROBLEM: The meter takes 100 measurements in about 70 milliseconds, great, but time between loops is crazy long, in this case 60+ milliseconds.

 

I've tried so much. And read so so much. Please send help 🙂

 

Thanks!!!

0 Kudos
Message 1 of 10
(1,723 Views)

Think about it.  You have to send a command.  It has to receive it.  It has to take a measurement.  It has to send the results back.  You have to read it.  That's a lot of stuff going on.

 

Some instruments have a "streaming" mode where you don't send explicit read commands, but just "drink from the firehose".

 

I have to ask why it's so important to take current measurements so quickly.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 10
(1,674 Views)

@fupper47 wrote:

HERE'S THE PROBLEM: The meter takes 100 measurements in about 70 milliseconds, great, but time between loops is crazy long, in this case 60+ milliseconds.


I'm not sure what you mean by "time between loops".  Are you referring to iterations of the loop?  Between what points in your code are you observing this 60ms?  I do have a big concern that you have ever-growing array on your While loop.  First of all, that should be a FOR loop since you know how many iterations will happen (you can enable the conditional terminal to abort early).  Secondly, you really should look at using a Producer/Consumer so that you are logging the data to the file while you are acquiring data.  This will save memory and post processing time.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 10
(1,659 Views)

Hi Bill,

 

Yeah so we're doing some advanced Chem research, pulsing a cell 500-1000 Hz, so wanting to read current changes from that, and not trying to spend $$$ doing it because it's just a small piece of the experiment. Unfortunately, a direct current measure is what were after here.

 

Yeah, that is a lot of data getting transferred around. I just feel like the whole process shouldn't take so long. There has to be something slowing down the process. Each Read only gets you 28 Kbytes max, is GPIB really that slow? I understand it takes time to gather measurements, but sending them over to the PC should happen at light speed compared to everything else. I mean data transferred rates are much much greater than 1 KHz, so what's the hold up? I switched the binary data, and that only gets you marginal gains in speed.

 

You're right about 'streaming' data. I've looked into that also. I just can't find where this instrument does that, I think I might be too dumb to do it. So I've had no success with that.

 

Thanks for the reply and good comments!

0 Kudos
Message 4 of 10
(1,616 Views)

Hi!

 

Yes, 'time between loops' would mean the time it takes to perform 1 loop.

 

Not doing FOR loops because we don't know how many loops will be needed. No matter though, WHILE loops vs. FOR loops makes no change to the timing.

 

Excellent tip for looking into the Producer/Consumer model!!! I haven't seen or used this before. Do you have any good tips or links for using this with VISA READ and VISA WRITE with 488.2 device or similar?

 

Thanks so much for you help!

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

@fupper47 wrote:

Excellent tip for looking into the Producer/Consumer model!!! I haven't seen or used this before. Do you have any good tips or links for using this with VISA READ and VISA WRITE with 488.2 device or similar?


Just take your read data and enqueue it.  Your processing loop can interpret the data however you need it to and log it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 10
(1,608 Views)

For clarity, can you go into further detail about how exactly this would work?

 

I not a total newb on LabView, but this seems like a more advanced topic.

 

Take your time if you need to, I'm in no rush.

 

Thanks again!

0 Kudos
Message 7 of 10
(1,604 Views)

An EXTREMELY crude example here.  This is far from acceptable in my opinion, but it hopefully shows the general structure.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 10
(1,596 Views)

Awesome! I will have to get into it and try to set this up to see how it goes.

 

Thanks for you efforts!

0 Kudos
Message 9 of 10
(1,591 Views)

There's something in the manual about buffering.  I wonder if this can be used to do "batch" readings, and if so, would that be acceptable?

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 10
(1,568 Views)