:MMEMory:DATA , The BASIC program will send the following data :MMEMory:DATA ’amiqsico.wv’, #3140 # The ASCII character # initiates binary block transfer 3 Number of digits of subsequent length information in ASCII 140 Length in ASCII of binary data record bytes 140 bytes of curve form The data file is generated using the Pascal program listed after the BASIC program. ===== BASIC Program ==================================== 10 IEC TERM 10 20 IEC OUT 6,"*rst" 30 REM wait after reset 40 HOLD 15000 50 IEC OUT 6,"*dcl" 60 IEC OUT 6,"*cls" 70 IEC OUT 6,":system:beeper:state off" 80 REM define memory 90 DIM Z$(1000) 100 REM open your file e.g. SICO.WV 110 OPENI# 5,"sico.wv" 120 REM read data from file 130 Z$=INPUT$(999,#5) 140 REM get number of bytes 150 L=LEN(Z$) 160 REM convert number of bytes into string 170 D$=STR$(L,USING "###") 180 REM merge data from your file into GPIB 190 REM command and send it to AMIQ via GPIB 200 REM to AMIQ hard disk (file: AMIQSICO.WV) 210 IEC OUT 6,":MMEM:data 'amiqsico.wv', #3"+D$+Z$ 220 REM load data from AMIQ hard disk into 230 REM AMIQ memory 240 IEC OUT 6,":MMEM:load ram, 'amiqsico.wv';*wai" 250 REM start to run AMIQ outputs 260 IEC OUT 6,":output:I VAR" 270 IEC OUT 6,":output:Q VAR" 280 IEC OUT 6,":trig:imm" 290 REM read AMIQ status byte 300 IEC OUT 6,"*stb?" 310 IEC IN 6,A$ 320 PRINT "AMIQ status (0 if ok): ",A$ =========================================================== =========================================================== =========================================================== The data for SICO.WV are generated using the following Pascal program: program sincos (input, output); (* GENERATION OF A WAVEFORM DATA SET FOR AMIQ ============================================ The program generates a data set to output a sine and cosine wave at the I and Q outputs of AMIQ. The sine and cosine values range from -1 to 0 to +1. To transfer the values to AMIQ they must be converted into binary format consisting of integer 16-bit-wide numbers without a sign. + 1 ---> 64768 ... 0 ---> 32768 ... - 1 ---> 768 Before this binary data set can be processed further, the TYPE tag {TYPE: WV, xxxxxxx} must be placed in front. The TYPE tag must be the first entry in a WAVEFORM file. WV means that the file contains a curve which is closed upon itself. xxxxxxx is the checksum of the waveform file. To simplify our example, 0 is used, i.e. AMIQ does not evaluate a checksum. The binary data must now be packed into a WAVEFORM tag with the following structure: {WAVEFORM-Length: Start,# IQIQIQIQIQIQIQIQIQI ... IQ} The WAVEFORM tag consists of the following characters and data: { Opens each tag. WAVEFORM Name of the tag for waveform files. - Separates the name from the length indication. Length Length of the data set Length indicates the number of bytes of the data set and consists of: number of digits of the start value (1 to 7, in our example 1) + length of ",#" (2 bytes) + number of I/Q pairs * 4 (2 bytes for each I and Q value). : Separates the name and length from the remainder of the data set. The blank can be omitted. Start Address in the output memory of AMIQ used to store the following samples. In our example and most applications, this will be '0'. ,# Indicates the beginning of the binary data. IQIQIQ Binary data set. The binary data contain the I and Q values in alternate order. The first value is an I value. Each value consists of 2 bytes, starting with the least significant bit. } Terminates each tag. The tags TYPE and WAVEFORM are mandatory for each waveform file. All other tags can be inserted after the TYPE tag in arbitrary order, e.g. {TYPE: WV,0} {COMMENT: I/Q=sine/cosine, 20 points, clock 10 MHz} {CLOCK: 10e6} {FILTER: 2,5MHz} {WAVEFORM-83: 0,# IQIQIQIQIQIQ ... IQ} *) const STEPS = 20; (* Range 0 to 3.14 divided into 20 steps *) FNAME = 'SICO.WV'; (* Output file *) HEADTEXT = '{TYPE: WV, 0}'; (* Header in file *) CLOCKTEXT = '{CLOCK: 10e6}'; (* optional *) FILTERTEXT = '{FILTER: 2,5MHz}'; (* optional *) WAVETEXT1 = '{WAVEFORM-'; (* Start of waveform data *) WAVETEXT3 = ': 0,#'; (* Waveform data *) ENDETEXT = '}'; (* End of waveform data *) var fv : file; sinus : real; cosinus : real; i : integer; j : integer; x : real; value : array[0..(STEPS * 2)] of word; charline : string; begin assign(fv, FNAME); (* define and open file for write *) rewrite(fv, 1); writeln('Neu'); (* output some text on screen *) x := 0.0; j := 0; charline := HEADTEXT; (* write header to file *) blockwrite(fv, charline[1], length(charline)); charline := CLOCKTEXT; (* optional write to file *) blockwrite(fv, charline[1], length(charline)); charline := FILTERTEXT; (* optional write to file *) blockwrite(fv, charline[1], length(charline)); charline := WAVETEXT1; (* write first part of waveform header to file *) blockwrite(fv, charline[1], length(charline)); str(((STEPS * 4) + 3):3, charline); (* write data length of waveform to file *) blockwrite(fv, charline[1], length(charline)); charline := WAVETEXT3; (* terminate waveform header *) blockwrite(fv, charline[1], length(charline)); for i := 0 to STEPS do begin (* Calculate STEPS number of sine and cosine values. Change the equations to generate other functions. Make sure that the values are in the range 768 <= sinus <= 64768 768 <= cosinus <= 64768 *) sinus := ((64000.0 * (sin(x) + 1.0) / 2.0) + 768.0); cosinus := ((64000.0 * (cos(x) + 1.0) / 2.0) + 768.0); value[j] := trunc(sinus); (* real to integer (I) and write to buffer *) value[j + 1] := trunc(cosinus); (* real to integer (Q) and write to buffer *) (* output values to screen *) writeln(value[j]:10, value[j + 1]:10, sin(x):10:2, cos(x):10:2); x := x + (2.0 * PI / STEPS); (* calculate next x *) j := j + 2; (* calculate next buffer position *) end; blockwrite(fv, value, STEPS * 4); (* write buffer to file *) charline := ENDETEXT; (* write end marker to file *) blockwrite(fv, charline[1], length(charline)); close(fv); end.