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.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Waiting a time after viClear

Solved!
Go to solution

Hello there, 

 

I am a student working on a project for my bachelor. the project I am working on is to controled a device of Keysight on a Embedded Windows 7 platform. Before I start my code (in c++) I use the "viClear" command from the VISA library to preform a device clear. The problem with this is that the device needs some time to process the command. I can just put a delay between it and the rest of my code but isn't there a right way to do this with the VISA library? I have the same thing whenever I send a "*TST?" command to my device and want to read the result. 

 

do you guys have any tips for me ?

0 Kudos
Message 1 of 4
(824 Views)
Solution
Accepted by topic author ToonB_NMBS

Hi

Depending on the instrument you can always check the status register.

In VISA there is a function to read this register and this status register should have a busy bit. I'm not sure this works but that is the best guess I have at this moment.

I'm mostly using LabVIEW for accessing instruments and most drivers show a vi to check the status register.

You did not mention your device so I cannot look it up for you.

 

If you have questions just reply to this post

greetings from the Netherlands
Message 2 of 4
(796 Views)

Yeah I just found that solution too. I couldn't realy scheck my device itself because it was occupied processing but I read the status byte on the bus which is 16 when ready and 17 when data can be read.

 

Thanks for repying tho, I am working on a custom program in c++ for the Keysight B1506A. I want to have full control on its measurement unit so that I can measure from my own application on it. The device runs on "Embedded Windows 7 standard" and for now I can send voltages out but getting the measure data is the roadblock for me right now 

 

if you guys have any other tips or thoughts, please let me know. 

thnx 

0 Kudos
Message 3 of 4
(792 Views)

 

I saw in the LabVIEW driver that the channels you want to measure from are enabled.

Measurement mode is set e.g. to sampling and the the measurement started.

Next is clearing the output data buffer.

Send a manual trigger,

And after that with a big timeout of 60 seconds are read back into a string each channel.

These strings are having a measurement, status, channel and Data type. 

 

good luck

greetings from the Netherlands
Message 4 of 4
(786 Views)