166 Chapter 4
Downloading and Using Files
Downloading ARB Waveform Data
delete [] buf;
}
else
{
fprintf(stderr, "Could not allocate memory for copy buffer\n");
}
fclose(file);
iclose(id);
return 0;
}
Downloading Using HP BASIC for Windows
The following program uses HP BASIC for Windows to download a waveform into WFM1. The
waveform generated by this program is the same as the default SINE_TEST_WFM waveform file available in
the signal generator’s waveform memory. This code is similar to the code shown “Downloading Using HP
BASIC for UNIX” on page 168, but there is a formatting difference in line 130 and line 140.
To download into NVWFM, replace line 190 with:
190 OUTPUT @Psg USING "#,K";":MMEM:DATA ""NVWFM:testfile"", #"
As discussed at the beginning of this section, I and Q waveform data is interleaved into one file in 2’s
compliment form and a marker file is associated with this I/Q waveform file.
In the Output commands, USING "#,K" formats the data. The pound symbol (#) suppresses the automatic
end of line (EOL) output. This allows multiple output commands to be concatenated as if they were a single
output. The “K” instructs HP BASIC to output the following numbers or strings in the default format.
10 ! RE-SAVE "BASIC_Win_file"
20 Num_points=200
30 ALLOCATE INTEGER Int_array(1:Num_points*2)
40 DEG
50 FOR I=1 TO Num_points*2 STEP 2
60 Int_array(I)=INT(32767*(SIN(I*360/Num_points)))
70 NEXT I
80 FOR I=2 TO Num_points*2 STEP 2
90 Int_array(I)=INT(32767*(COS(I*360/Num_points)))
100 NEXT I