This program assumes that you are using Agilent IO Libraries. If not, you must find and use other VISA libraries that allow the conversion from a binary value to a real number. You must also have a reference to the VISA COM driver. To create a Visual Basic® program that uses VISA COM, create your project in your normal manner then click on the
Project
menu and select
References
. Scroll down the list and select
VISA COM 1.0 Type Library
and
Agilent VISA COM Resource Manager 1.0
, then click
OK
. If they don't appear in the list, select
Browse...
and navigate to the file c:\program files\visa\visacom\visacom.tlb. (Note: A single quote (`) marks the beginning of a comment in the following program. This program declares the
test_set
variable to be linked to the VISA COM library.
The binary transfer queries return an IEEE 488 definite length arbitrary header block, followed by an arbitrary data block that contains single-precision floating point numbers in IEEE 754 format that represent the amplitude and phase data results. This program was built using Visual Basic®, and uses
ReadIEEEBlock
to convert the binary data returned by the test set into ASCII data.
This algorithm that returns binary values, sampled at 13/3 million samples per second (4.333 MHz, or 4.333 samples per microsecond).This example sets the number of samples to measure to 2500. Therefore, this measurement takes approximately 0.577 ms to take 2500 samples at the sample rate of 4.333 samples per microsecond.
10 Test_set=714 !Sets variable "Test_set" = 8960's default GPIB address
20 !
30 DIM Ident$[200]! Sets a variable to store the *IDN result
40 !
50 Count=2500 ! 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;"*idn?" ! Extra commands to identify specific 8960 used
140 ENTER Test_set;Ident$
150 PRINT "Test Set ID = ";Ident$
160 !
170 OUTPUT Test_set;"*RST"
180 ! Resets all Test Set values to their default settings; only necessary at
190 ! beginning of program (not at beginning of each PAvT measurement)
200 !
210 OUTPUT Test_set;"SYST:SYNC?"
220 ENTER Test_set;Sync_result
230 ! Ensures previous commands are complete before executing other commands
240 ! so that elapsed time measurements are valid for each sub-section
250 !
260 !OUTPUT Test_set;"SYST:LOG:UI:GPIB:STAT ON"
270 !Turns on UI logging for GPIB troubleshooting; use web browser to retrieve
280 ! log --->>> Remove this line after your program works correctly <<<---
290 !
300 !
310 Tsetup_start=TIMEDATE
320 !OUTPUT Test_set;"SYSTem:CORRection:SFRequency 890.2 MHz"
330 !OUTPUT Test_set;"SYST:CORR:GAIN -7"
340 ! Turn on RF offset for attenuation between phone & test set
350 !
360 OUTPUT Test_set;"CALL:OPERating:MODE EBPT"
370 ! Sets operating mode to EGPRS BCH+PDTCH (test mode; no call processing)
380 !
390 OUTPUT Test_set;"RFANalyzer:MANual:MEASurement:MFRequency 890.2 MHz"
400 ! Sets the expected input frequency manually.
410 !
420 OUTPUT Test_set;"RFAN:CONTrol:POWer:AUTO OFF"
430 ! Sets the input level to manual control.
440 !
450 OUTPUT Test_set;"RFAN:MAN:POWer:BURSt 10 dbm"
460 ! Adjusts the Test Set to the expected power level (typically the maximum
470 ! expected input level in the TX waveform).
480 !
490 OUTPUT Test_set;"CALL:POW:STATe OFF"
500 ! Turns off the RF generator cell power, if desired.
510 !
520 OUTPUT Test_set;"SYST:SYNC?"
530 ENTER Test_set;Sync_result
540 !Ensures previous commands are complete before executing other commands
550 ! so that elapsed time measurements are valid for each sub-section
560 Tsetup_time=TIMEDATE-Tsetup_start
570 PRINT " Elapsed Test Set SETUP time = ";Tsetup_time;" seconds"
580 !
590 !
600 !**** Setup for PAvT Measurement ****!
610 !------------------------------------!
620 Pcalset_start=TIMEDATE
630 OUTPUT Test_set;"SETup:PCALibration:TIMeout:STIMe 10"
640 !Sets the measurement timeout period to 10 seconds, and the state to on.
650 !
660 OUTPUT Test_set;"SETup:PCAL:TRIGger:SOURce rise"
670 !Sets the trigger source as desired (RISE, IMMediate, or EXTernal).
680 !
690 OUTPUT Test_set;"SETup:PCAL:TRIG:THReshold 5"
700 !Adjusts the trigger level in dB below the expected input power level.
710 !
720 OUTPUT Test_set;"SETup:PCAL:WAVeform:TYPe CONT2"
730 !Chooses the continuous (sampled) version of the PAvT measurement
740 !
750 OUTPUT Test_set;"SETup:PCAL:TRIG:DELay 0us"
760 ! Adjusts the trigger delay; default value=0; default unit is seconds.
770 ! Adjusts the time the test set waits after a physical trigger event,
780 ! before the Analog to Digital Converter acquires waveform samples.
790 !
800 ! OUTPUT Test_set;"SETup:PCAL:MEASurement:DELay 0us"
810 ! USE ONLY FOR CONTINUOUS ALGORITHMS!
820 ! Adjusts the measurement delay; default value is 0; default units is
830 ! seconds. Adjusts time the test set waits after a physical trigger
840 ! event, before the "measurement" begins (this means, where in time the
850 ! filtering & vector analysis into amplitude/phase pairs begins). This
860 ! allows you to ignore initial waveform samples if desired.
870 !
880 OUTPUT Test_set;"SETup:PCAL:MEAS:COUNt";Count
890 ! Sets the number of continuous samples
900 !
910 OUTPUT Test_set;"SYST:SYNC?"
920 ENTER Test_set;Sync_result
930 !Ensures previous commands are complete before executing other commands
940 ! so that elapsed time measurements are valid for each sub-section
950 Pcalset_time=TIMEDATE-Pcalset_start
960 PRINT " Elapsed PAvT SETUP time = ";Pcalset_time;" seconds"
970 !
980 !
990 !***********************************************************************
1000 ! DECIMAL MEASUREMENT SECTION
1010 ! The first portion of the program uses decimal fetches of the results.
1020 !***********************************************************************
1030 !
1040 !
1050 !****Setup phase & amplitude arrays for DECIMAL results.****!
1060 !-----------------------------------------------------------!
1070 ALLOCATE Phase1$[18000],Phase2$[18000],Phase3$[9000]
1080 ALLOCATE Amplit1$[18000],Amplit2$[18000],Amplit3$[9000]
1090 !Dimension results arrays (of type=string) to contain the measurement
1100 ! data; reserves computer memory for the arrays; string size set to
1110 ! 18000 based on (1000 values max. x 18 characters per value)
1120 ! [9000 = 500 values x 18 char/value]
1130 !
1140 !
1150 !****Initialize the measurement & get DECIMAL results.****!
1160 !---------------------------------------------------------!
1170 Meas_start=TIMEDATE
1180 OUTPUT Test_set;"INITiate:PCALibration"
1190 !Initiates the PAvT measurement and waits until
1200 ! results are returned (or until the measurement timeout interval elapses).
1210 !
1220 OUTPUT Test_set;"SYST:SYNC?"
1230 ENTER Test_set;Sync_result
1240 !Ensures previous commands are complete before executing other commands
1250 ! so that elapsed time measurements are valid for each sub-section
1260 !
1270 !PRINT "*** Agilent E1968A Phase & Amplitude vs. Time Measurement ***"
1280 !PRINT ""
1290 !PRINT "--> INSTRUCTIONS TO USER:"
1300 !PRINT "--> Command the wireless device to transmit the test waveform"
1310 !PRINT "--> (before the end of the measurement timeout interval)."
1320 !PRINT ""
1330 !
1340 Meas_time=TIMEDATE-Meas_start
1350 PRINT " Elapsed MEASUREMENT time = ";Meas_time;" seconds"
1360 !
1370 !
1380 !****Fetch DECIMAL phase & ampl. data; store results in arrays.****!
1390 !------------------------------------------------------------------!
1400 ! Each DECIMAL fetch returns up to 1000 comma-separated values; see PAvT
1410 ! documentation for more details for Fetch:Pcal:Sample description
1420 Decdata_st=TIMEDATE
1430 OUTPUT Test_set;"FETCh:PCAL:SAMPle:AMPLitude:dbm? 1"
1440 ENTER Test_set;Amplit1$
1450 OUTPUT Test_set;"FETCh:PCAL:SAMPle:AMPLitude:dbm? 2"
1460 ENTER Test_set;Amplit2$
1470 OUTPUT Test_set;"FETCh:PCAL:SAMPle:AMPLitude:dbm? 3"
1480 ENTER Test_set;Amplit3$
1490 OUTPUT Test_set;"FETCh:PCAL:SAMPle:PHASe? 1"
1500 ENTER Test_set;Phase1$
1510 OUTPUT Test_set;"FETCh:PCAL:SAMPle:PHASe? 2"
1520 ENTER Test_set;Phase2$
1530 OUTPUT Test_set;"FETCh:PCAL:SAMPle:PHASe? 3"
1540 ENTER Test_set;Phase3$
1550 Decdata_tm=TIMEDATE-Decdata_st
1560 PRINT " Elapsed DECIMAL data retrieve time = ";Decdata_tm;" seconds"
1570 !
1580 !
1590 !
1600 !*************************************************************************
1610 ! BINARY MEASUREMENT SECTION
1620 ! It's much faster to retrieve the data in BINARY, so the second portion
1630 ! of the program repeats the measurement process, but uses binary fetches.
1640 !*************************************************************************
1650 !
1660 !
1670 !****Setup phase & amplitude arrays for BINARY results.****!
1680 !----------------------------------------------------------!
1690 ALLOCATE Phasbin$[10000],Amplbin$[10000]
1700 !Dimension results arrays (of type=string) to contain the binary
1710 ! measurement data; should be 2500 results x 4 bytes each = 10000 values
1720 ! for a full 577us burst.
1730 !
1740 !
1750 !****Fetch BINARY phase & ampl. data; store results in arrays.****!
1760 !-----------------------------------------------------------------!
1770 Bindata_st=TIMEDATE
1780 OUTPUT Test_set;"FETCh:PCALibration:SAMPle:AMPLitude:BINary?"
1790 ENTER Test_set;Amplbin$
1800 OUTPUT Test_set;"FETCh:PCALibration:SAMPle:PHASe:BINary?"
1810 ENTER Test_set;Phasbin$
1820 Bindata_tm=TIMEDATE-Bindata_st
1830 PRINT " Elapsed BINARY data retrieve time = ";Bindata_tm;" seconds"
1840 PRINT ""
1850 !
1860 !****Fetch DECIMAL PAvT integrity indicator and sample count****!
1870 !**** (same for both the DECIMAL and BINARY methods)
1880 ! [note that these data cannot be retrieved in binary format]
1890 !---------------------------------------------------------------!
1900 OUTPUT Test_set;"FETCh:PCAL:SAMPle:COUNt?"
1910 ENTER Test_set;Result_count
1920 ! Number of results for amplitude and phase pairs (integer value)
1930 PRINT "Number of measured amplitude and phase pairs = ";Result_count
1940 OUTPUT Test_set;"FETCh:PCAL:INTegrity?"
1950 ENTER Test_set;Integrity
1960 ! Read PAvT measurement integrity from the Test Set.
1970 PRINT "Integrity value =";Integrity
1980 PRINT ""
1990 PRINT ""
2000 IF Integrity<>0 THEN
2010 ! If measurement integrity does not equal zero, there is an error.
2020 PRINT "Measurement Error; Integrity Value = ";Integrity
2030 PRINT ""
2040 ELSE
2050 END IF
2060 !
2070 !
2080 !****For illustration: prints 1st values from DECIMAL ampl. array.****!
2090 !---------------------------------------------------------------------!
2100 PRINT "----------------- DECIMAL Amplitude Data #1 --------------------"
2110 PRINT Amplit1$
2120 PRINT "----------------------------------------------------------------"
2130 !
2140 DEALLOCATE Phase1$,Amplit1$,Phase2$,Amplit2$,Phase3$,Amplit3$
2150 ! Releases computer memory allocated for decimal arrays
2160 !
2170 !
2180 !****For illustration: prints values from BINARY amplitude array.****!
2190 !--------------------------------------------------------------------!
2200 !PRINT "----------------- BINARY Amplitude Data ---------------------"
2210 !PRINT Amplbin$
2220 !PRINT "-------------------------------------------------------------"
2230 !
2240 DEALLOCATE Phasbin$,Amplbin$
2250 ! Releases PC memory allocated for binary arrays
2260 !
2270 !
2280 !****End of program****!
2290 !----------------------!
2300 OUTPUT Test_set;"INIT:PCAL:OFF"
2310 ! Turns off the PAvT measurement at the end of the program
2320 END
2330 !
2340 Timeout: SUB Timeout
2350 PRINT "Program timeout!!"
2360 CLEAR 7 ! Clears the PC's GPIB interface (at select code 7)
2370 CLEAR 714 ! Clears the Test Set GPIB interface
2380 SUBEND