LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture a .gif file from a spectrum analyzer and save the file in PC

Solved!
Go to solution

I want to capture a .gif file from a spectrum analyzer and save the file in PC, but I've got a problem when read data from the instrument. I'm not sure how to format the string got from the instrument , When I use "%s" or "%t" as the read string format the data got from the instrument is truncated.

my code are as follows, could anyone tell me where i am wrong?

 

char resultsArray[5000];

viPrintf(hSpectrumInstr, ":MMEM:STOR:SCR 'C:PICTURE.GIF'\n");
 viQueryf(hSpectrumInstr, ":MMEM:DATA? 'C:PICTURE.GIF'\n", "%t", resultsArray);
 printf("%s", resultsArray);
 getchar();       

0 Kudos
Message 1 of 12
(4,856 Views)

For raw / binary data you might try the %b or %y specifier, see here

0 Kudos
Message 2 of 12
(4,855 Views)

Hi wolfgang 

it seemed that %b or %y is not accepted by the read string format. the run-time error is like this:

NON-FATAL RUN-TIME ERROR

"Spectrum Alnalyzer.c",line 29, col 5, thread id 0x00004284

Function viQueryf: (return value == -1073807297 [0xbfff003f])

the string format modifier is not valid.

0 Kudos
Message 3 of 12
(4,851 Views)

forgot to tell , my spectrum analyzer is Agilent E4447,  is it possible that the string format for this instrument is not the same as the specifier mentioned in "Using VISA Formatted I/O in Instrument Driver Development"?

0 Kudos
Message 4 of 12
(4,846 Views)

So how is your modifier? Can you post the relevant line?

0 Kudos
Message 5 of 12
(4,845 Views)

char resultsArray[5000];

viPrintf(hSpectrumInstr, ":MMEM:STOR:SCR 'C:PICTURE.GIF'\n");
viQueryf(hSpectrumInstr, ":MMEM:DATA? 'C:PICTURE.GIF'\n", "%b", resultsArray);

0 Kudos
Message 6 of 12
(4,843 Views)
Solution
Accepted by topic author pauline01

as you may see your code is unreadable, can you post a screenshot or, as before, a Word document?

 

When using '%b' the array should be of type ViInt8

0 Kudos
Message 7 of 12
(4,841 Views)

sorry so late to reply,  my code is in the following word:

0 Kudos
Message 8 of 12
(4,807 Views)

did you try declaring your array as type ViInt8 ?

0 Kudos
Message 9 of 12
(4,794 Views)

Yes, I've tried declaring the variable 'resultArray' to ViInt8,  it also doesn't  work. It's strange the "%b" and "%y" are declared invalid for the string format modifier. I used the NI Max to communicate with the analyzer, it can read back correct data, so i think  my code relevant with capture pic probablly has problem. 

0 Kudos
Message 10 of 12
(4,788 Views)