Programming instructions
Downloading and Using Files
ARB Waveform Data Downloads
Chapter 4 163
Example Programs
Waveform Downloading Using HP BASIC for Windows
The following program shows
you how to download waveforms using HP BASIC for Windows
into volatile ARB memory.
This program is similar to the following program example as well as the previous examples.
The difference between BASIC for UNIX and BASIC for Windows is the way the formatting,
for the most significant bit (MSB) on lines 110 and 120, is handled.
To download into non-volatile ARB memory, replace line 80 with:
80 OUTPUT @ESG USING "#,K";":MMEM:DATA ""NVARBI:testfile"", #"
and replace line 130 with:
130 OUTPUT @ESG USING "#,K";":MMEM:DATA ""NVARBQ:testfile"", #"
First, the I waveform data is put into an array of integers called Iwfm_data and the Q
waveform data is put into an array of integers called Qwfm_data. The variable Nbytes is set
to equal the number of bytes in the I waveform data. This should be twice the number of
integers in Iwfm_data, since an integer is 2 bytes. Input integers must be between 0 and
16383.
In the Output commands, USING “#,K” formats the data. The pound symbol (#) suppresses
the automatic EOL (End of Line) 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 "ARB_IQ_Win_file"
20 Num_points=200
30 ALLOCATE INTEGER Iwfm_data(1:Num_points),Qwfm_data(1:Num_points)
40 DEG
50 FOR I=1 TO Num_points
60 Iwfm_data(I)=INT(8191*(SIN(I*360/Num_points))+8192)
70 Qwfm_data(I)=INT(8191*(COS(I*360/Num_points))+8192)
80 NEXT I
90 PRINT "Data Generated"
100 Nbytes=2*Num_points
110 ASSIGN @Esg TO 719
120 !ASSIGN @Esgb TO 719;FORMAT MSB FIRST
130 Nbytes$=VAL$(Nbytes)
140 Ndigits=LEN(Nbytes$)
150 Ndigits$=VAL$(Ndigits)
160 OUTPUT @Esg USING "#,K";"MMEM:DATA ""ARBI:file_name_1"",#"
170 OUTPUT @Esg USING "#,K";Ndigits$
180 OUTPUT @Esg USING "#,K";Nbytes$
190 OUTPUT @Esgb;Iwfm_data(*)
200 OUTPUT @Esg;END
210 OUTPUT @Esg USING "#,K";":MMEM:DATA ""ARBQ:file_name_1"",#"
220 OUTPUT @Esg USING "#,K";Ndigits$
230 OUTPUT @Esg USING "#,K";Nbytes$