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: 

Reading a scope signal works in Highlight Execution but not in real time

Solved!
Go to solution

I want to obtain the max. value of a waveform from an old 54622A Agilent scope via GPIB.

The problem is that I consistently obtain a Visa Read error -1073807339 ("Timeout expired before operation completed") when running in real time, but NEVER in Highlight Execution mode.

 

The posts here suggests that timing may cause the Read to execute before the Write has been able to finish. So, I used a manually-controlled While Loop, Sequence Structure, and Waiting blocks to try and ultra-separate the Read and Write blocks from overlapping each other. But it still does not work!!

 

Any suggestions, please? (Thank you!)

 

visaRead_delay.png

 

If you happen to open the VI I attached, you will see that I am using a serial port. This is because I am using a Prologix USB-GPIB adaptor to interface with the scope (I don't have a NI USB-GPIB adaptor). I have successfully used this Prologix adaptor for over 2 years to communicate perfectly fine with an SR830 lock-in amplifier and several other devices, so I don't think that is the problem...

0 Kudos
Message 1 of 8
(3,544 Views)
Solution
Accepted by topic author tanaaron

What you need is the Magical Delay FairySmiley LOL


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 2 of 8
(3,539 Views)

Highlight execution intentionally slows down code so you can watch it executing.  Which will of course interfere with any code that relies on timing such as instrument communication and timeout values.

0 Kudos
Message 3 of 8
(3,510 Views)

There should be a query to see if the measurement is complete, at least there is on Tek Scopes. If one exists, you can poll to see when the measurement is ready, or you can use a SRQ.

 

A bet there is an example of this in the programming manual for the scope.

 

Cheers,

mcduff

0 Kudos
Message 4 of 8
(3,487 Views)

What is your baud rate?

 

I see you have a timeout of 2 seconds set.  You are trying to read 512 bytes.  If your baud rate is 9600, that is about 1000 bytes per second.  It would take about 1/2 second to read 512 bytes, plus whatever amount of time it takes for the device to prepare its response.

 

If your baud rate is lower such as 4800 or lower,  I can easily see how it could take longer than 2 seconds to get a response.

0 Kudos
Message 5 of 8
(3,472 Views)

Hello all,

 

Thanks for all the suggestions. Somehow the Magic Delay Fairy worked, but the delay time had to be set to 3.4 seconds!!! The baud rate is 9600. Would you have any suggestions to make the delay time less? The weird thing is, if I try to read fewer bytes (like 128), I have to actually wait LONGER...

 

Aaron

0 Kudos
Message 6 of 8
(3,455 Views)

Ha..ha..ha.. you know what was creating the huge delay time? My horizontal timescale setting on the scope... set at 200ms/div, it would take a few seconds to complete one "dataset". Once I sped up the scope reading to 2 ms/div, I could read without using any delay VI blocks!

 

Such a silly mistake cost me 2 days of time...

0 Kudos
Message 7 of 8
(3,445 Views)
Solution
Accepted by topic author tanaaron

There yoy go.  it wasn't baud rate but the time it took for the device to respond.

0 Kudos
Message 8 of 8
(3,434 Views)