Programming Example
This program demonstrates use of the Phase & Amplitude versus Time Measurement for a continuous waveform. This program does not calibrate the Spectrum Monitor, however it is important to do so at regular intervals. If you have not performed the recommend monthly calibration of your test set, an example program is provided, see
Example Spectrum Monitor Program
.
This example does not apply to a discrete waveform.
The continuous algorithm samples at 13/12 million samples per second (1.083 MHz, or 1.083 samples per microsecond).
The variable
Count
in line 30 sets the number of samples to be measured. This measurement takes approximately 2.31 ms to take 2500 samples at the sample rate of 1.083 samples per microsecond. Since this measurement returns data in blocks of up to 1000 values, this program separates the 2500 results into two string arrays containing 1000 values each and a third string array with 500 values. This is done for both the amplitude and phase results, giving a total of six arrays. (Note: The exclamation mark (!) symbol causes the compiler to ignore any text that follows it until the end of the line.)
10 !* 180 Test_set=714
20 !Sets program variable "Test_set" equal to the 8960's default GPIB address
30 !
40 Count=867
50 ! Sets a variable for the number of samples to measure
60 !
70 ON TIMEOUT 7,15 CALL Timeout
80 !Timeout protection subroutine; after 15 seconds of inactivity, the
90 ! program stops and clears the GPIB bus (so the GPIB bus doesn't hang)
100 !
110 !****Test Set Setup****!
120 !----------------------!
130 OUTPUT Test_set;"*RST"
140 !Resets all Test Set values to their default settings.
150 !
160 OUTPUT Test_set;"SYST:SYNC?"
170 ENTER Test_set;Sync_result
180 !Ensures previous commands are complete before executing following commands.
190 !
200 !OUTPUT Test_set;"SYST:LOG:UI:GPIB:STAT ON"
210 !Turns on UI logging for GPIB troubleshooting;
220 ! --->>> COMMENT this line out of your program after it works <<<---
230 !
240 OUTPUT Test_set;"CALL:OPERating:MODE CW"
250 !Sets the operating mode to CW (test mode; no call processing).
260 !
270 OUTPUT Test_set;"RFANalyzer:MANual:MEASurement:MFRequency 890.2 MHz"
280 !Sets the expected input frequency manually.
290 !
330 OUTPUT Test_set;"RFAN:CW:EXP:POW 10 dbm"
340 !Adjusts the Test Set to the expected power level (the maximum
350 ! expected input level in the TX waveform).
360 !
370 OUTPUT Test_set;"CALL:POW:STATe OFF"
380 !Turns off the RF generator cell power, if desired.
390 !
400 !**** Setup for PAvT Measurement ****!
410 !------------------------------------!
420 OUTPUT Test_set;"SETup:PCALibration:TIMeout:STIMe 10"
430 !Sets the measurement timeout period to 10 s, and state to on.
440 !
450 OUTPUT Test_set;"SETup:PCAL:TRIGger:SOURce RISE"
460 !Sets the trigger source (RISE, IMMediate, or EXTernal).
470 !
480 OUTPUT Test_set;"SETup:PCAL:TRIG:THReshold 10"
490 !Adjusts trigger level in dB below the expected input power level.
500 !
510 OUTPUT Test_set;"SETup:PCAL:WAVeform:TYPe CONTinuous"
520 !Chooses the continuous (sampled) version of the PAvT measurement
530 !
540 OUTPUT Test_set;"SETup:PCAL:TRIG:DELay 0"
550 ! Adjusts the trigger delay; default value is 0; default unit is seconds.
560 ! Adjusts the time the test set waits after the rising edge of the initial
570 ! GSM reference burst, before the Analog to Digital Converter acquires
580 ! waveform samples.
590 !
600 ! OUTPUT Test_set;"SETup:PCAL:MEASurement:DELay 0"
610 ! Adjusts the measurement delay; default value is 0; default units is
620 ! seconds. Adjusts the time the test set waits after the falling edge of
630 ! the initial GSM reference burst, before the "measurement" begins (this
640 ! means, where in time the filtering and vector analysis into amplitude &
650 ! phase pairs begins). This allows you to ignore initial waveform
660 ! information if desired.
670 !
680 OUTPUT Test_set;"SETup:PCAL:MEAS:COUNt";Count
690 ! Sets the number of continuous samples
700 !
710 OUTPUT Test_set;"SYST:SYNC?"
720 ENTER Test_set;Sync_result
730 !Ensures previous commands are complete before executing following commands.
740 !
750 !****Initialize the measurement & get results.****!
760 !-------------------------------------------------!
770 OUTPUT Test_set;"INITiate:PCALibration"
780 !Initiates the PAvT measurement and waits until
790 ! results are returned (or until the measurement timeout interval elapses).
800 !
810 PRINT "*** Agilent E1968A Phase & Amplitude vs. Time Measurement ***"
820 PRINT ""
830 PRINT "--> INSTRUCTIONS TO USER:"
840 PRINT "--> Command the wireless device to transmit the test waveform"
850 PRINT "--> (before the end of the measurement timeout interval)."
860 PRINT ""
870 !
880 OUTPUT Test_set;"FETCh:PCAL:SAMPle:COUNt?"
890 ENTER Test_set;Result_count
900 ! Number of results available for amplitude and phase pairs (integer value)
910 PRINT "Number of measured amplitude and phase pairs = ";Result_count
920 !
930 OUTPUT Test_set;"FETCh:PCAL:INTegrity?"
940 ENTER Test_set;Integrity
950 ! Read PAvT measurement integrity from the Test Set.
960 PRINT "Integrity value =";Integrity
970 PRINT ""
980 IF Integrity<>0 THEN ! If measurement integrity value does not equal zero,
990 ! there is an error.
1000 PRINT "Measurement Error; Integrity Value = ";Integrity
1010 PRINT ""
1020 ELSE
1030 END IF
1040 !
1050 !****Fetch absolute power****!
1060 !----------------------------!
1070 OUTPUT Test_set;"FETCh:PCAL:REFerence:POWer?"
1080 ENTER Test_set;Ref_power
1090 ! Returns absolute power in dBm of initial GSM reference burst for
1100 ! continuous PAvT algorithm
1110 PRINT " Absolute Power Measurement = ";Ref_power;" dBm"
1120 PRINT ""
1130 !
1140 !****Setup phase & amplitude arrays for results.****!
1150 !---------------------------------------------------!
1160 ALLOCATE Phase1$[15606],Amplit1$[15606]
1170 !Dimension results arrays for strings to contain the measurement
1180 ! data (because fetches for lots of decimal data into PC's are often faster
1190 ! using strings); reserves computer memory for the arrays; string size of
1200 ! 15606 based on 867 values x 18 (18 characters per string value in HT BASIC)
1210 !
1220 !****Fetch phase & amplitude data; store results in arrays.****!
1230 !--------------------------------------------------------------!
1240 OUTPUT Test_set;"FETCh:PCAL:SAMPle:AMPLitude? 1"
1250 ENTER Test_set;Amplit1$
1260 OUTPUT Test_set;"FETCh:PCAL:SAMPle:PHASe? 1"
1270 ENTER Test_set;Phase1$
1280 ! Each Fetch returns up to 1000 comma-separated values; see PAvT
1290 ! documentation for more details for Fetch:Pcal:Sample description
1300 !
1310 !****For illustration: prints values from one array.****!
1320 !-------------------------------------------------------!
1330 PRINT "Amplitude1 Data (867 comma-separated values)"
1340 PRINT "---------------------------------------------"
1350 PRINT Amplit1$
1360 !
1370 !****Convert amplitude data to dBm if desired****!
1380 !------------------------------------------------!
1390 ! Amplitude value in dbm = 20 * log10 (amplitude sample)
1400 !
1410 DEALLOCATE Phase1$,Amplit1$
1420 ! Releases computer memory allocated for arrays
1430 !
1440 OUTPUT Test_set;"INIT:PCAL:OFF"
1450 ! Turns off the PAvT measurement at the end of the program
1460 !
1470 END
1480 !*****Ends the program.****!
1490 !
1500 Timeout: SUB Timeout
1510 PRINT "Program timeout!!"
1520 CLEAR 7 ! Clear PC GPIB Interface device (at select code 7)
1530 CLEAR 714 ! Clear Test Set GPIB interface
1540 SUBEND
1550 !