visa to visadev, how can I pass a header to the "writebinblock" function

2 vues (au cours des 30 derniers jours)
Viktor Ott
Viktor Ott le 16 Jan 2023
How can I pass a header to the "writebinblock" function?
This is the header:
header = ':TRACe1:DATA 1,0,'
old function ("inst" created with the old function "visa"):
binblockwrite(inst, data, 'int16', header)
new function ("inst" created with the new function "visadev"):
writebinblock(inst, data ,"int16")
Is there a manuel way like this? (not working)
header = int16(double(':TRACe1:DATA 1,0,'))
writebinblock(inst, [header data],"int16")

Réponses (1)

HimeshNayak
HimeshNayak le 14 Mar 2023
Hi Viktor
As per my understanding you want to switch from “visa” to “visadev” and pass header with data into “writebinblock” function.
“writebinblock” does not support header now. You may use “write” function for the same.
To convert the following:
binblockwrite(inst, data, uint8, header)
You may write:
header = uint8(headerStr);
rawData = [header, data];
write(inst, rawdata, precision);
For more information on “write” function, you may visit: https://in.mathworks.com/help/instrument/serialport.write.html
Regards
HimeshNayak
  1 commentaire
John Vandermeer
John Vandermeer le 3 Mai 2023
Modifié(e) : John Vandermeer le 3 Mai 2023
What is left out of this conversion is that the binblockwrite() function would automatically pre-pend the IEEE 488.2–1992 section 7.7.6 block data header to the data so that the user did not need to include this in the "header" portion. As far as I can tell, the visadev write() function does NOT do this, so the block data header must be manually added to the desired ASCII header for the SCPI command to the instrument.
From looking at NI I/O Trace of both write and binblockwrite, it does appear that binblockwrite pre-pends the IEEE 488.2–1992 section 7.7.6 block data header to the data buffer that is given, so if you give it a buffer consisting of the SCPI command and data, you end up with the block data header before your SCPI command. So, using write() and manually embedding the block data header is going to be the only solution.
The visadev write function is documented at https://www.mathworks.com/help/instrument/visadev.write.html.
It feels like some of the examples showing how to use the old visa interface need to be ported to the new one to show how to use it properly.

Connectez-vous pour commenter.

Produits


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by