Appendix B — IQ Waveform Capture B-2 C++ Code (IQ_SCPI.cpp)
MS2720T PM PN: 10580-00341 Rev. C B-5
B-2 C++ Code (IQ_SCPI.cpp)
This script initiates a capture but does not allow for the data to be saved on the instrument.
Instead, data is saved directly to the PC.
/*
Anritsu Company
Example SCPI-based program to initiate IQ capture and receive data on PC
Data captured using this program will be written to binary output,
data.bin.
Data points are packed in an alternating fashion: I0, Q0, I1, Q1...
Each data point is 3 bytes in size (I0 = 3 bytes, Q0 = 3 bytes).
*/
#include "stdafx.h"
#include "stdio.h"
#include "string.h"
#include "visa.h"
#include <windows.h>
#define BUFFER_SIZE 0x80000/* maximum size of scpi response buffer */
int _tmain(int argc, _TCHAR* argv[])
{
ViStatus status; /* For checking errors */
ViSession defaultRM, instr; /* Communication channels */
ViUInt32 retCount; /* Return count from string I/O */
char *pAddress;
char *pFileName;
FILE * fd;
int i;
ViChar cmdBuf[256];
ViChar statStr[256];
char dataBuf[BUFFER_SIZE];
ООО "Техэнком" Контрольно-измерительные приборы и оборудование www.tehencom.com