フィルターのクリア

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

6 ビュー (過去 30 日間)
Viktor Ott
Viktor Ott 2023 年 1 月 16 日
編集済み: John Vandermeer 2023 年 5 月 3 日
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")

回答 (1 件)

HimeshNayak
HimeshNayak 2023 年 3 月 14 日
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 件のコメント
John Vandermeer
John Vandermeer 2023 年 5 月 3 日
編集済み: John Vandermeer 2023 年 5 月 3 日
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.

サインインしてコメントする。

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by