cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

*LRN? and binary block data

Resolvido!
Ir para a solução

Hello,

 

I am using a Keysight E4990A Impedance Analyzer.  I would like to be able to save and recall setups.  I've used the *LRN? command in the past on other instruments to do this.  On those instruments, a text file was output with a chain of commands.  With the analyzer, binary block data is returned after the *LRN? query.

 

I am able to receive a response using this command, but I can't figure out how to "reuse" it so that I can load or bring up the setup later.  I have been reading about binary blocks and the IEEE 745 format.

 

_natalie__0-1641419951722.png

 

Using the *LRN? commands, I receive the following text.  I see the # symbol, the number 6 and 6 bytes in the header. Everything including and after the :SYST:SET must be the binary data if I understand everything correctly.

 

_natalie__1-1641420051055.png

 

Now, if I manually save the setup and lookup up the setup file on the analyzer (saved as a .sta file), the data saved in the file starts after the #6004111:SYST:SET #44095.  I do not understand where the #44095 data came from.  I understand that it's necessary to use SYST:SET with the correct binary block to update the settings.  

 

If I add the #44095, I'm told there is...

 

_natalie__2-1641420665834.png

 

If I try to calculate the size, assuming the #4 means the number of bytes and the other integers represent the size of the binary data, I get the same error (using the System Set VI).

 

I have attached the manual, and the VIs I have built.

 

Any help is greatly appreciated.

 

Thanks

 

PS - I am using LabVIEW 2016

 

 

 

0 Kudos
Mensagem 1 de 9
4.263Exibições
Solução
Aceita por _natalie_

This is a common thing for Agilent/Keysight devices to transmit large data in a binary format.  But then you need to know how large the data is.  So Agilent/Keysight use a datablock format.  The datablock format is a #, then an ASCII character to state how many characters are in the length (so 4 means there are 4 characters to state the length), then the length of the data in an ASCII numeric format ("4095" indicates there are 4095 bytes in the data), and finally the data which is the size as determined in the length section of the header.

 

But you will also need to send a New Line character to terminate the block.



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
Mensagem 2 de 9
4.238Exibições

Thanks crossrulz!

 

I had made a couple of mistakes in my code.  I wasn't reading all of the data before saving it, I was saving it as a text file and not a binary file, and I wasn't setting up the header properly when sending it back to the instrument with the :SYST:SET command.

0 Kudos
Mensagem 3 de 9
4.182Exibições

Hi, I'm having similar issues with two different types of keysight scopes, i can receive lrn strings ok but having issues sending them back. Would it be possible to see the working code ? Cheers 

0 Kudos
Mensagem 4 de 9
4.014Exibições

Sure, I am using LabVIEW 2016.  What are you using?

0 Kudos
Mensagem 5 de 9
4.007Exibições

Hi, I'm on 2021 but I do have 2015 and 2020 as well, many thanks Dave

0 Kudos
Mensagem 6 de 9
3.989Exibições

I believe you can open these with LabVIEW 2020/2021.  Let me know how it goes.

Baixar tudo
0 Kudos
Mensagem 7 de 9
3.966Exibições

Hi Natalie

 

That was really useful, so I was reading the learn string back ok and storing as a binary file, but when i was trying to resend it back, I was not sending the # followed by the length of the string to be sent before sending the learn string. Once I took that bit from your code it worked first time. Cant thank you enough Dave

0 Kudos
Mensagem 8 de 9
3.953Exibições

Happy it worked for you!

0 Kudos
Mensagem 9 de 9
3.926Exibições