Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Captured Jpeg transfer from Instrumental by MMEmory:DATA

Solved!
Go to solution

Jpeg File transfer from Instrumental to PC.

Hello, Please give your help regarding captured Jpeg file transferring from instrumental to PC via NI-VISA on VB.NET with followings.


DMM.WriteString("MMEMory:DATA? 'AAA.jpg'")
out_Msg = DMM.ReadString

returned message includes <header> and <Bindata>.
<headder> includes Len of Bindata(num of byte).

So I removed <headder> part and converted it to byte style by following.

Dim bs As Byte() = System.Text.Encoding.GetEncoding("shift_jis").GetBytes(remain_msg)

And wrote it as binary.

fs.Write(bs, 0, bs.Length)

After that, File was saved as Jpeg but can't open as pitcure.

I compared with original Jpeg got from instrumental.and I made via above. Actual File size is little bit different from original jpeg.
Also character corruption are seen.

Does someone has idea to fix it ? or any good sample program ?

0 Kudos
Message 1 of 2
(138 Views)
Solution
Accepted by topic author takafu

I could transfer jpeg File from instrumental with following method.

1)Request instrumental to start data transfer.
DMM.WriteString("MMEMory:DATA? 'AAA.jpg'")

2)Read message by "ReadIEEEBlock".
out_Msg = DMM.ReadIEEEBlock(IEEEBinaryType.BinaryType_UI1)
out_Msg should be defined as byte.

3)save as binary file
Dim fs As New System.IO.FileStream("C:\AAA.jpg", System.IO.FileMode.Create, System.IO.FileAccess.Write)
fs.Write(out_Msg, 0, out_Msg.Length)
fs.close

 

0 Kudos
Message 2 of 2
(62 Views)