LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview VISA write binary file using the *LRN? Query

Solved!
Go to solution

Hi,

I want to write a VI that use the *LRN? query for a Aglient InfiniiVision 7k Series Scope. With my infiniium scope this wasn't a problem. I simply stored the *LRN? return in a textfile and then used VisaWriteFromFile to load the settings at a later time. The Infiniium returns a string and all is fine. So the new InfiniiVision returns "binary block data in IEEE 488.2 # format". I tried to save the *LRN? return in a binary file but it doesn't work. Can anyone help me with this? Thank you

0 Kudos
Message 1 of 7
(3,559 Views)

Hi Dust,

 

I tried to save the *LRN? return in a binary file but it doesn't work. Can anyone help me with this?

So there is "something" that "doesn't work". How can we help you on this "something"?

 

What does "not work"?

What is the error you get?

Where are you stuck?

 

Can you attach your VI with your try to save some data?

Can you create a string indicator with default data? Read the query result from your device into a string indicator, then right-click the string and "make current values default". Then save your VI and attach it!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(3,539 Views)

Hi thanks for the reply. In the attached vi you can see what i tried. I also attached the data file with the saved data.

What is not working: When I want to send the data with the "load scope settings" button the scope returns a "invalid character" or a "invalid seperator" error. Maybe also the saving of the data is wrong done from me. Also the VISAWriteFromFile function says that it opens in binary mode so i thought this could be the solution. For the infiniium i used the same vi except that i use the WriteToTextFile function instead of the WriteToBinaryFile function. With the Infiniium it works fine because the *LRN? query returns a string.

Thanks for your help.

Greetings

Download All
0 Kudos
Message 3 of 7
(3,535 Views)

Hi Dust,

 

you are sending the data back to your device without any additional command.

I guess the scope expects some kind of command before it accepts the data!

(It's the same with reading the data: first you send a command, then you can read the data…)

 

I'm sure you read the manual of the scope before. I'm also sure you will find the answer to your question in this manual! 😉

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,517 Views)

Hi Gerd,

Yes i read the manual before. The return data of the *LRN? Query includes a scope specific command before the binary block data.

 

From the manual:

"The *LRN? query result contains the current state of the instrument. This
query is similar to the :SYSTem:SETup? (see page 449) query, except that
it contains ":SYST:SET " before the binary block data. The query result is a
valid command that can be used to restore instrument settings at a later
time."

 

Greetings

0 Kudos
Message 5 of 7
(3,510 Views)
Solution
Accepted by topic author FlyingDust

Hi Dust,

 

From the manual:…

This really helped to spot the problem! 🙂

 

When you look at your saved dataset you will recognize 4 leading bytes infront of the : SYSTEM: SET command! These 4 bytes are the size of the saved data - and are written by default when you use the WriteBinaryFile function. Just switch off those 4 bytes as is described in the help of this file function… 😄

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 7
(3,506 Views)

Hi Gerd,

 

OMG shame on me. Thank you so much 😃 It works perfectly =). You are my hero of the day 😄

 

Thanks and have a nice day!

0 Kudos
Message 7 of 7
(3,501 Views)