Measurement Guide and Programming Manual For Spectrum Analyzers PSA and ESA Series

Measurement Guide and Programming Manual For Spectrum Analyzers PSA and ESA Series
Pages 346
Views 4,739
Downloads : 9 times
PDF Size : 4.7 MiB

Summary of Contents

Measurement Guide and Programming Manual For Spectrum Analyzers PSA and ESA Series

  • Page 1

    Measurement Guide and Programming ExamplesPSA and ESA Series Spectrum AnalyzersThis manual provides documentation for the following instruments:Agilent Technologies PSA SeriesE4443A (3 Hz - 6.7 GHz) E4445A (3 Hz - 13.2 GHz) E4440A (3 Hz - 26.5 GHz)E4446A (3 Hz - 44 GHz)E4448A (3 Hz - 50 GHz)Agi...

  • Page 2

    2 NoticeThe information contained in this document is subject to change without notice.Agilent Technologies makes no warranty of any kind with regard to this material, including but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Agilent Technologi...

  • Page 3

    3WARNINGThis is a Safety Class 1 Product (provided with a protective earth ground incorporated in the power cord). The mains plug shall be inserted only in a socket outlet provided with a protected earth contact. Any interruption of the protective conductor inside or outside of the product is li...

  • Page 4

    4

  • Page 5

    Contents 5Table of Contents 9,1. 9,Recommended Test Equipmen 9,t 11,2. 11,Measuring Multiple Signals 12,Comparing Signals on the Same 12,Screen Using Marker 12, Delta 12, . . . . . . 12,. . . . . . . 12,. . . . . . . 12,. . . 12 14,Comparing Signals on the Same 14,Screen Using Marker 14, ...

  • Page 6

    6 ContentsTable of Contents 67,9. 67,Measuring Digital 67, Communications Signals 68,Making Burst 68, Power 68, Measurements 68, . . . . . . 68, . . . . . . 68,. . . . . . . 68,. . . . . . . 68,. . . . . . . 68,. . . . . . . 68,. . .68 71,Making Statistical 71,Power Measurements 71, (CCDF...

  • Page 7

    Contents 7Table of Contents 157,AM and FM Demodulati 157,on Concepts 157, . . . . 157, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 158,Stimulus Response Measurement 158, Concepts 158, 158,. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1...

  • Page 8

    8 ContentsTable of Contents 323,Using C 323, Over 323, Socket LAN (W 323,indows NT) . 323, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323,323 326,Using Java Programming Over 326, Socket LAN . 326,. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3...

  • Page 9

    9Recommended Test Equipment1Recommended Test Equipment

  • Page 10

    10Chapter 1 Recommended Test EquipmentRecommended Test EquipmentNOTETo find descriptions of specific analyzer functions, for the ESA, refer to the Agilent Technologies ESA Series Spectrum Analyzers User’s/Programmer’s Reference Guide and for the PSA, refer to the Agilent Technologies PSA Seri...

  • Page 11

    11Measuring Multiple Signals2Measuring Multiple Signals

  • Page 12

    12Chapter 2 Measuring Multiple SignalsComparing Signals on the Same Screen Using Marker DeltaMeasuring Multiple SignalsComparing Signals on the Same Screen Using Marker DeltaUsing the analyzer, you can easily compare frequency and amplitude differences between signals, such as radio or television...

  • Page 13

    Chapter 213Measuring Multiple SignalsComparing Signals on the Same Screen Using Marker DeltaMeasuring Multiple SignalsStep 4.Place a marker at the highest peak on the display (10 MHz): Press Peak Search.The Next Pk Right and Next Pk Left softkeys are available to move the marker from peak to peak...

  • Page 14

    14Chapter 2 Measuring Multiple SignalsComparing Signals on the Same Screen Using Marker Delta PairMeasuring Multiple SignalsComparing Signals on the Same Screen Using Marker Delta PairIn this procedure, the analyzer 10 MHz signal is used to measure frequency and amplitude differences between two ...

  • Page 15

    Chapter 215Measuring Multiple SignalsComparing Signals not on the Same Screen Using Marker DeltaMeasuring Multiple SignalsComparing Signals not on the Same Screen Using Marker DeltaMeasure the frequency and amplitude difference between two signals that do not appear on the screen at one time. (Th...

  • Page 16

    16Chapter 2 Measuring Multiple SignalsComparing Signals not on the Same Screen Using Marker DeltaMeasuring Multiple SignalsStep 3.Set the center frequency, span and reference level to view only the 10 MHz signal:Press FREQUENCY Channel, Center Freq, 10, MHz.Press SPAN X Scale, Span, 5, MHz.Press ...

  • Page 17

    Chapter 217Measuring Multiple SignalsResolving Signals of Equal AmplitudeMeasuring Multiple SignalsResolving Signals of Equal AmplitudeIn this procedure a decrease in resolution bandwidth is used in combination with a decrease in video bandwidth to resolve two signals of equal amplitude with a fr...

  • Page 18

    18Chapter 2 Measuring Multiple SignalsResolving Signals of Equal AmplitudeMeasuring Multiple SignalsFigure 2-7Unresolved Signals of Equal Amplitude (ESA)Step 4.Change the resolution bandwidth (RBW) to 100 kHz so that the RBW setting is less than or equal to the frequency separation of the two sig...

  • Page 19

    Chapter 219Measuring Multiple SignalsResolving Signals of Equal AmplitudeMeasuring Multiple SignalsAs the resolution bandwidth is decreased, resolution of the individual signals is improved and the sweep time is increased. For fastest measurement times, use the widest possible resolution bandwidt...

  • Page 20

    20Chapter 2 Measuring Multiple SignalsResolving Small Signals Hidden by Large SignalsMeasuring Multiple SignalsResolving Small Signals Hidden by Large SignalsThis procedure uses narrow resolution bandwidths to resolve two input signals with a frequency separation of 155 kHz and an amplitude diffe...

  • Page 21

    Chapter 221Measuring Multiple SignalsResolving Small Signals Hidden by Large SignalsMeasuring Multiple SignalsFigure 2-9Signal Resolution with a 30 kHz RBW (ESA left, PSA right)Step 5.Reduce the resolution bandwidth filter to view the smaller hidden signal. Place a delta marker on the smaller sig...

  • Page 22

    22Chapter 2 Measuring Multiple SignalsDecreasing the Frequency Span Around the SignalMeasuring Multiple SignalsDecreasing the Frequency Span Around the SignalUsing the analyzer signal track function, you can quickly decrease the span while keeping the signal at center frequency. This is a fast wa...

  • Page 23

    Chapter 223Measuring Multiple SignalsDecreasing the Frequency Span Around the SignalMeasuring Multiple SignalsStep 6.Reduce span and resolution bandwidth to zoom in on the marked signal:Press SPAN X Scale, Span, 200, kHz.NOTEIf the span change is large enough, the span decreases in steps as autom...

  • Page 24

    24Chapter 2 Measuring Multiple SignalsDecreasing the Frequency Span Around the SignalMeasuring Multiple Signals

  • Page 25

    25Measuring a Low−Level Signal3Measuring a Low−Level Signal

  • Page 26

    26Chapter 3 Measuring a Low−Level SignalReducing Input AttenuationMeasuring a Low−Level SignalReducing Input AttenuationThe ability to measure a low-level signal is limited by internally generated noise in the spectrum analyzer. The measurement setup can be changed in several ways to improve ...

  • Page 27

    Chapter 327Measuring a Low−Level SignalReducing Input AttenuationMeasuring a Low−Level SignalStep 6. Set the attenuation to 20 dB:Press AMPLITUDE Y Scale, Attenuation, 20, dB.Note that increasing the attenuation moves the noise floor closer to the signal level. A “#” mark appears next to ...

  • Page 28

    28Chapter 3 Measuring a Low−Level SignalDecreasing the Resolution BandwidthMeasuring a Low−Level SignalDecreasing the Resolution BandwidthResolution bandwidth settings affect the level of internal noise without affecting the level of continuous wave (CW) signals. Decreasing the RBW by a decad...

  • Page 29

    Chapter 329Measuring a Low−Level SignalUsing the Average Detector and Increased Sweep TimeMeasuring a Low−Level SignalUsing the Average Detector and Increased Sweep TimeWhen the analyzer’s noise masks low-level signals, changing to the average detector and increasing the sweep time smooths ...

  • Page 30

    30Chapter 3 Measuring a Low−Level SignalTrace AveragingMeasuring a Low−Level SignalTrace AveragingAveraging is a digital process in which each trace point is averaged with the previous average for the same trace point. Selecting averaging, when the analyzer is autocoupled, changes the detecti...

  • Page 31

    31Improving Frequency Resolution and Accuracy4Improving Frequency Resolution and Accuracy

  • Page 32

    32Chapter 4 Improving Frequency Resolution and AccuracyUsing a Frequency Counter to Improve Frequency Resolution and AccuracyImproving Frequency Resolution and AccuracyUsing a Frequency Counter to Improve Frequency Resolution and AccuracyThis procedure uses the spectrum analyzer internal frequenc...

  • Page 33

    Chapter 433Improving Frequency Resolution and AccuracyUsing a Frequency Counter to Improve Frequency Resolution and AccuracyImproving Frequency Resolution and AccuracyFigure 4-1Using Marker Counter (ESA Display)Step 6.Change counter resolution:ESA frequency-counter resolution can be set from 1 Hz...

  • Page 34

    34Chapter 4 Improving Frequency Resolution and AccuracyUsing a Frequency Counter to Improve Frequency Resolution and AccuracyImproving Frequency Resolution and Accuracy

  • Page 35

    35Tracking Drifting Signals5Tracking Drifting Signals

  • Page 36

    36Chapter 5 Tracking Drifting SignalsMeasuring a Source’s Frequency DriftTracking Drifting SignalsMeasuring a Source’s Frequency DriftThe analyzer can measure the short- and long-term stability of a source. The maximum amplitude level and the frequency drift of an input signal trace can be di...

  • Page 37

    Chapter 537Tracking Drifting SignalsMeasuring a Source’s Frequency DriftTracking Drifting SignalsStep 7.Activate trace 2 (trace 2 should be underlined) and change the mode to continuous sweeping:(ESA) Press View/Trace, Trace (2).(PSA) Press Trace/View, Trace (2).Press Clear Write.Trace 1 remain...

  • Page 38

    38Chapter 5 Tracking Drifting SignalsTracking a SignalTracking Drifting SignalsTracking a SignalThe signal track function is useful for tracking drifting signals that drift relatively slowly by keeping the signal centered on the display as the signal drifts. This procedure tracks a drifting signa...

  • Page 39

    39Making Distortion Measurements6Making Distortion Measurements

  • Page 40

    40Chapter 6 Making Distortion MeasurementsIdentifying Analyzer Generated DistortionMaking Distortion MeasurementsIdentifying Analyzer Generated DistortionHigh level input signals may cause analyzer distortion products that could mask the real distortion measured on the input signal. Using trace 2...

  • Page 41

    Chapter 641Making Distortion MeasurementsIdentifying Analyzer Generated DistortionMaking Distortion MeasurementsStep 7.To determine whether the harmonic distortion products are generated by the analyzer, first save the trace data in trace 2 as follows: (ESA) Press View/Trace, Trace (2), Clear Wri...

  • Page 42

    42Chapter 6 Making Distortion MeasurementsThird-Order Intermodulation DistortionMaking Distortion MeasurementsThird-Order Intermodulation DistortionTwo-tone, third-order intermodulation distortion is a common test in communication systems. When two signals are present in a non-linear system, they...

  • Page 43

    Chapter 643Making Distortion MeasurementsThird-Order Intermodulation DistortionMaking Distortion MeasurementsStep 3.Set the analyzer center frequency and span:Press Preset, Factory Preset (if present).Press FREQUENCY Channel, Center Freq, 300.5, MHz.Press SPAN X Scale, Span, 5, MHz.Step 4.Reduce ...

  • Page 44

    44Chapter 6 Making Distortion MeasurementsMeasuring TOI Distortion with a One-Button MeasurementMaking Distortion MeasurementsMeasuring TOI Distortion with a One-Button MeasurementOne-button power measurements are a part of the Power Suite measurement utility and are standard on all ESA and PSA m...

  • Page 45

    Chapter 645Making Distortion MeasurementsMeasuring Harmonics and Harmonic Distortion with a One-ButtonMeasurementMaking Distortion MeasurementsMeasuring Harmonics and Harmonic Distortion with a One-Button MeasurementThis procedure measures the harmonics of the 10 MHz reference output signal. The ...

  • Page 46

    46Chapter 6 Making Distortion MeasurementsMeasuring Harmonics and Harmonic Distortion with a One-Button MeasurementMaking Distortion MeasurementsFigure 6-6Measuring the Harmonic Distortion The amplitudes of the harmonics are listed relative to the fundamental frequency.NOTEAn asterisk (*) appeari...

  • Page 47

    47Measuring Noise7Measuring Noise

  • Page 48

    48Chapter 7 Measuring NoiseMeasuring Signal-to-NoiseMeasuring NoiseMeasuring Signal-to-Noise Signal-to-noise is a ratio used in many communication systems as an indication of noise in a system. Typically the more signals added to a system adds to the noise level, reducing the signal-to-noise rati...

  • Page 49

    Chapter 749Measuring NoiseMeasuring Signal-to-NoiseMeasuring Noisemeasurement results:(ESA) Press Marker, More, Function, Marker Noise.(PSA) Press Marker Fctn, Marker Noise.Figure 7-1Measuring the Signal-to-Noise Read the signal-to-noise in dB/Hz, that is with the noise value determined for a 1 H...

  • Page 50

    50Chapter 7 Measuring NoiseMeasuring Noise Using the Noise MarkerMeasuring NoiseMeasuring Noise Using the Noise MarkerThis procedure uses the marker function, Marker Noise, to measure noise in a 1 Hz bandwidth. In this example the noise marker measurement is made near the 50 MHz reference signal ...

  • Page 51

    Chapter 751Measuring NoiseMeasuring Noise Using the Noise MarkerMeasuring NoiseIncreasing the sweep time when the average detector is enabled allows the trace to average over a longer time interval, thus reducing the variations in the results (increases measurement repeatability).Step 5.Move the ...

  • Page 52

    52Chapter 7 Measuring NoiseMeasuring Noise-Like Signals Using Marker PairsMeasuring NoiseMeasuring Noise-Like Signals Using Marker PairsMarker pairs let you measure power over a frequency span. The markers allow you to easily and conveniently select any arbitrary portion of the displayed signal. ...

  • Page 53

    Chapter 753Measuring NoiseMeasuring Noise-Like Signals Using Marker PairsMeasuring NoiseFigure 7-3Band Power Marker Power Measurement (ESA left, PSA right)Step 7.Set the marker span pair to Center to move the markers (set at 40 kHz span) around without changing the span. Use the front-panel knob ...

  • Page 54

    54Chapter 7 Measuring NoiseMeasuring Noise-Like Signals Using the Channel Power MeasurementMeasuring NoiseMeasuring Noise-Like Signals Using the Channel Power MeasurementYou may want to measure the total power of a noise-like signal that occupies some bandwidth. Typically, channel power measureme...

  • Page 55

    Chapter 755Measuring NoiseMeasuring Noise-Like Signals Using the Channel Power MeasurementMeasuring NoiseStep 7.Optimize the analyzer reference level setting:Press Meas Setup, Optimize Ref Level.Your display should be similar to 55,Figure 55,7-4.Figure 7-4Measuring Channel Power (ESA left, PSA ...

  • Page 56

    56Chapter 7 Measuring NoiseMeasuring Noise-Like Signals Using the Channel Power MeasurementMeasuring Noise

  • Page 57

    57Making Time-Gated Measurements8Making Time-Gated Measurements

  • Page 58

    58Chapter 8 Making Time-Gated MeasurementsGenerating a Pulsed-RF FM SignalMaking Time-Gated MeasurementsGenerating a Pulsed-RF FM SignalTraditional frequency-domain spectrum analysis provides only limited information for certain signals. Examples of these difficult-to-analyze signal include the f...

  • Page 59

    Chapter 859Making Time-Gated MeasurementsGenerating a Pulsed-RF FM SignalMaking Time-Gated MeasurementsStep 2. Set up ESG #1 to transmit a pulsed-RF signal with frequency modulation. Set the FM deviation to 1 kHz and the FM rate to 50 kHz:ESG #1 generates the pulsed FM signal by frequency modulat...

  • Page 60

    60Chapter 8 Making Time-Gated MeasurementsGenerating a Pulsed-RF FM SignalMaking Time-Gated MeasurementsStep 3. Set up the oscilloscope to view the trigger, gate and RF signals (see 60,Figure 60, 8-1 60, for an example of the oscilloscope display):Figure 8-1 Viewing the Gate Timing with an Oscil...

  • Page 61

    Chapter 861Making Time-Gated MeasurementsConnecting the Instruments to Make Time-Gated MeasurementsMaking Time-Gated MeasurementsConnecting the Instruments to Make Time-Gated Measurements 61,Figure 61, 8-2 61, shows a block diagram of the test setup. ESG #1 produces a pulsed FM signal by using an...

  • Page 62

    62Chapter 8 Making Time-Gated MeasurementsGated LO Measurement (PSA)Making Time-Gated MeasurementsGated LO Measurement (PSA)This procedure utilizes gated LO to gate the FM signal. For concept and theory information about gated LO see 135,“How Time 135, Gating 135, Works” 135, on 135, 135,pa...

  • Page 63

    Chapter 863Making Time-Gated MeasurementsGated LO Measurement (PSA)Making Time-Gated MeasurementsIn 62,Figure 62, 8-3 62, the vertical green parallel bars represent the gate settings. The first (left) bar is set at the delay time while the second (right) bar is set at the gate length, measured f...

  • Page 64

    64Chapter 8 Making Time-Gated MeasurementsGated Video Measurement (ESA)Making Time-Gated MeasurementsGated Video Measurement (ESA)This procedure utilizes gated video to gate the FM signal. For concept and theory information about gated video see 135,“How Time 135, Gating 135, 135,Works” 135...

  • Page 65

    Chapter 865Making Time-Gated MeasurementsGated Video Measurement (ESA)Making Time-Gated MeasurementsStep 3. Set the gate delay to 2 ms and the gate length to 1 ms. Check that the gate control is set to edge with a positive trigger:Press Sweep, Gate, Gate Control (Edge).Press Edge Gate, Slope (Pos...

  • Page 66

    66Chapter 8 Making Time-Gated MeasurementsGated FFT Measurement (PSA)Making Time-Gated MeasurementsGated FFT Measurement (PSA)This procedure utilizes gated FFT to gate the FM signal. For concept and theory information about gated FFT see 135,“How Time Gating Works 135,” 135, 135,on page 135...

  • Page 67

    67Measuring Digital Communications Signals9Measuring Digital Communications Signals

  • Page 68

    68Chapter 9 Measuring Digital Communications SignalsMaking Burst Power MeasurementsMeasuring Digital Communications SignalsMaking Burst Power MeasurementsPSA and ESA spectrum analyzers make power measurements on digital communication signals fast and repeatable by providing a comprehensive suite ...

  • Page 69

    Chapter 969Measuring Digital Communications SignalsMaking Burst Power MeasurementsMeasuring Digital Communications SignalsFigure 9-1Full Screen Display of Burst Power Measurement ResultsNOTEPress the Return key to exit the full screen display without changing any parameter values.Step 6.Select on...

  • Page 70

    70Chapter 9 Measuring Digital Communications SignalsMaking Burst Power MeasurementsMeasuring Digital Communications SignalsNOTEIf you set the burst width manually to be wider than the screen’s display, the vertical white lines move off the edges of the screen. This could give misleading results...

  • Page 71

    Chapter 971Measuring Digital Communications SignalsMaking Statistical Power Measurements (CCDF)Measuring Digital Communications SignalsMaking Statistical Power Measurements (CCDF)NOTECCDF can be measured with ESA-E series analyzers with option AYX or B7D and with all PSA series analyzers.Compleme...

  • Page 72

    72Chapter 9 Measuring Digital Communications SignalsMaking Statistical Power Measurements (CCDF)Measuring Digital Communications SignalsFigure 9-3Power Stat CCDF Measurement on a W-CDMA SignalStep 5.Store your current measurement trace for future reference:Press Display, Store Ref Trace.When the ...

  • Page 73

    Chapter 973Measuring Digital Communications SignalsMaking Statistical Power Measurements (CCDF)Measuring Digital Communications SignalsStep 7.Change the measurement bandwidth to 1 MHz:Press Meas Setup, Meas BW, 1, MHz.Figure 9-5Reducing the measurement bandwidth to 1 MHzNOTEIf you choose a measur...

  • Page 74

    74Chapter 9 Measuring Digital Communications SignalsMaking Adjacent Channel Power (ACP) MeasurementsMeasuring Digital Communications SignalsMaking Adjacent Channel Power (ACP) MeasurementsThe adjacent channel power (ACP) measurement is also referred to as the adjacent channel power ratio (ACPR) a...

  • Page 75

    Chapter 975Measuring Digital Communications SignalsMaking Adjacent Channel Power (ACP) MeasurementsMeasuring Digital Communications SignalsFigure 9-6ACP Measurement on a Base Station W-CDMA SignalThe frequency offsets, channel integration bandwidths, and span settings can all be modified from the...

  • Page 76

    76Chapter 9 Measuring Digital Communications SignalsMaking Adjacent Channel Power (ACP) MeasurementsMeasuring Digital Communications SignalsFigure 9-7Measuring a Third Adjacent ChannelStep 8.Set pass/fail limits for each offset:Press Meas Setup, Offset/Limits, Offset (A), Neg Offset Limit, −55,...

  • Page 77

    Chapter 977Measuring Digital Communications SignalsMaking Multi-Carrier Power (MCP) MeasurementsMeasuring Digital Communications SignalsMaking Multi-Carrier Power (MCP) MeasurementsThe multi-carrier power measurement measures the total power of up to 12 carriers and their adjacent channels for up...

  • Page 78

    78Chapter 9 Measuring Digital Communications SignalsMaking Multi-Carrier Power (MCP) MeasurementsMeasuring Digital Communications SignalsPress Meas Setup, Carrier Setup, Carriers, 10, Enter.Step 6.Configure carrier 5 to have no power present:Press Meas Setup, Carrier Setup, Configure Carriers, Ca...

  • Page 79

    Chapter 979Measuring Digital Communications SignalsMaking Multi-Carrier Power (MCP) MeasurementsMeasuring Digital Communications SignalsFigure 9-10Combined Spectrum and Bar Graph ViewStep 11.Save the results file to a disk.Press File, Save, Type, More, Measurement Results, Save Now. The results a...

  • Page 80

    80Chapter 9 Measuring Digital Communications SignalsMaking Multi-Carrier Power (MCP) MeasurementsMeasuring Digital Communications Signals

  • Page 81

    81Using External Millimeter Mixers (Option AYZ)10Using External Millimeter Mixers (Option AYZ)

  • Page 82

    82Chapter 10 Using External Millimeter Mixers (Option AYZ)Making Measurements With Agilent 11970 Series Harmonic MixersUsing External Millimeter Mixers (Option AYZ)Making Measurements With Agilent 11970 Series Harmonic MixersExternal harmonic mixers can be used to extend the frequency range of th...

  • Page 83

    Chapter 1083Using External Millimeter Mixers (Option AYZ)Making Measurements With Agilent 11970 Series Harmonic MixersUsing External Millimeter Mixers (Option AYZ)Step 2.Perform a factory preset:Press Preset, Factory Preset (if present).Step 3.Set up a high frequency signal on a microwave signal ...

  • Page 84

    84Chapter 10 Using External Millimeter Mixers (Option AYZ)Setting Harmonic Mixer Bias CurrentUsing External Millimeter Mixers (Option AYZ)Setting Harmonic Mixer Bias CurrentThe Agilent 11970 Series harmonic mixers do not require an external bias current. Harmonic mixers that require bias can also...

  • Page 85

    Chapter 1085Using External Millimeter Mixers (Option AYZ)Entering Conversion-Loss Correction Data for Harmonic MixersUsing External Millimeter Mixers (Option AYZ)Entering Conversion-Loss Correction Data for Harmonic MixersYou may want to correct your measurement for the conversion-loss of the ext...

  • Page 86

    86Chapter 10 Using External Millimeter Mixers (Option AYZ)Making Measurements with Agilent 11974 Series Preselected Harmonic MixersUsing External Millimeter Mixers (Option AYZ)Making Measurements with Agilent 11974 Series Preselected Harmonic MixersPreselected mixers apply a tracking filter to th...

  • Page 87

    Chapter 1087Using External Millimeter Mixers (Option AYZ)Making Measurements with Agilent 11974 Series Preselected HarmonicMixersUsing External Millimeter Mixers (Option AYZ)of the display. The conversion-loss versus frequency data is on the calibration label on the bottom of the Agilent 11974, o...

  • Page 88

    88Chapter 10 Using External Millimeter Mixers (Option AYZ)Frequency Tracking Calibration with Agilent 11974 Series Preselected Harmonic MixersUsing External Millimeter Mixers (Option AYZ)Frequency Tracking Calibration with Agilent 11974 Series Preselected Harmonic MixersThis procedure is used to ...

  • Page 89

    Chapter 1089Using External Millimeter Mixers (Option AYZ)Frequency Tracking Calibration with Agilent 11974 Series PreselectedHarmonic MixersUsing External Millimeter Mixers (Option AYZ)Step 8.Change the analyzer center frequency to the value indicated in 89,Table 89,10-2 and again adjust the co...

  • Page 90

    90Chapter 10 Using External Millimeter Mixers (Option AYZ)Frequency Tracking Calibration with Agilent 11974 Series Preselected Harmonic MixersUsing External Millimeter Mixers (Option AYZ)

  • Page 91

    91Demodulating AM and FM Signals11Demodulating AM and FM Signals

  • Page 92

    92Chapter 11 Demodulating AM and FM SignalsMeasuring the Modulation Rate of an AM SignalDemodulating AM and FM SignalsMeasuring the Modulation Rate of an AM Signal This section demonstrates how to determine parameters of an AM signal, such as modulation rate and modulation index (depth) by using ...

  • Page 93

    Chapter 1193Demodulating AM and FM SignalsMeasuring the Modulation Rate of an AM SignalDemodulating AM and FM SignalsNOTEIf the trigger level is set too high or too low when video trigger mode is activated, the sweep stops. You need to adjust the trigger level up or down with the front-panel knob...

  • Page 94

    94Chapter 11 Demodulating AM and FM SignalsMeasuring the Modulation Index of an AM SignalDemodulating AM and FM SignalsMeasuring the Modulation Index of an AM SignalThis procedure demonstrates how to use the spectrum analyzer as a fixed-tuned (time-domain) receiver to measure the modulation index...

  • Page 95

    Chapter 1195Demodulating AM and FM SignalsMeasuring the Modulation Index of an AM SignalDemodulating AM and FM SignalsFigure 11-2AM Signal Measured in the Time DomainLEFT: 100% AM Signal (Modulation Index = 1)RIGHT: 80% AM Signal (Modulation Index = 0.8)

  • Page 96

    96Chapter 11 Demodulating AM and FM SignalsDemodulating an AM Signal Using the ESA SeriesDemodulating AM and FM SignalsDemodulating an AM Signal Using the ESA SeriesThe demodulation functions listed in the menu under Det/Demod allow you to demodulate and hear signal information displayed on the a...

  • Page 97

    Chapter 1197Demodulating AM and FM SignalsDemodulating an AM Signal Using the ESA SeriesDemodulating AM and FM Signalsmultiple times, keeping the signal of interest in the center of the display until the span is 1 MHz:Press SPAN X Scale, Span, (↓), Mkr→CF. Step 7.Set the analyzer into time-do...

  • Page 98

    98Chapter 11 Demodulating AM and FM SignalsDemodulating an FM Signal Using the ESA-E Series (Requires Option BAA)Demodulating AM and FM SignalsDemodulating an FM Signal Using the ESA-E Series (Requires Option BAA)This section demonstrates how to demodulate and listen to an FM signal using the ESA...

  • Page 99

    Chapter 1199Demodulating AM and FM SignalsDemodulating an FM Signal Using the ESA-E Series (Requires Option BAA)Demodulating AM and FM SignalsPress BW/Avg, Res BW, 30, kHz.Step 7.Turn on the FM demodulator:Press Det/Demod, Demod, FM.Step 8.Change the vertical scaling:Press AMPLITUDE Y Scale, Scal...

  • Page 100

    100Chapter 11 Demodulating AM and FM SignalsDemodulating an FM Signal Using the ESA-E Series (Requires Option BAA)Demodulating AM and FM SignalsFigure 11-5Calculating Frequency DeviationStep 10.Take a single sweep of the demodulated signal and then calculate the FM rate using delta markers on adj...

  • Page 101

    101Using Segmented Sweep (ESA-E Series Spectrum Analyzers)12Using Segmented Sweep (ESA-E Series Spectrum Analyzers)

  • Page 102

    102Chapter 12 Using Segmented Sweep (ESA-E Series Spectrum Analyzers)Measuring Harmonics Using Standard SweepUsing Segmented Sweep (ESA-E Series Spectrum Analyzers)Measuring Harmonics Using Standard SweepThis procedure measures the fundamental 50 MHz signal plus the second and third harmonics. Co...

  • Page 103

    Chapter 12103Using Segmented Sweep (ESA-E Series Spectrum Analyzers)Measuring Harmonics Using Standard SweepUsing Segmented Sweep (ESA-E Series Spectrum Analyzers)Figure 12-1 Measuring Harmonics with Standard Sweep

  • Page 104

    104Chapter 12 Using Segmented Sweep (ESA-E Series Spectrum Analyzers)Measuring Harmonics Using Segmented SweepUsing Segmented Sweep (ESA-E Series Spectrum Analyzers)Measuring Harmonics Using Segmented SweepSegmented sweep allows you to define many bands of interest and display them as a single tr...

  • Page 105

    Chapter 12105Using Segmented Sweep (ESA-E Series Spectrum Analyzers)Measuring Harmonics Using Segmented SweepUsing Segmented Sweep (ESA-E Series Spectrum Analyzers)Press Center Freq, 150, MHz.Press Span, 100, kHz.Press Video BW, 30, Hz.Notice that the total sweep time for the 3 segments is only 8...

  • Page 106

    106Chapter 12 Using Segmented Sweep (ESA-E Series Spectrum Analyzers)Using Segmented Sweep With Limit LinesUsing Segmented Sweep (ESA-E Series Spectrum Analyzers)Using Segmented Sweep With Limit LinesSegmented sweep can also use other standard spectrum analyzer functionality, such as limit lines....

  • Page 107

    Chapter 12107Using Segmented Sweep (ESA-E Series Spectrum Analyzers)Using Segmented Sweep With Limit LinesUsing Segmented Sweep (ESA-E Series Spectrum Analyzers)Step 10.Enter points 2 through 11 from 107,Table 107,12-1:Step 11.Turn the limits on:Press Return, Limit (On).Step 12.Turn the limit t...

  • Page 108

    108Chapter 12 Using Segmented Sweep (ESA-E Series Spectrum Analyzers)Using Segmented Sweep to Monitor the Cellular Activity of a cdmaOne BandUsing Segmented Sweep (ESA-E Series Spectrum Analyzers)Using Segmented Sweep to Monitor the Cellular Activity of a cdmaOne BandIn this example set up two se...

  • Page 109

    Chapter 12109Using Segmented Sweep (ESA-E Series Spectrum Analyzers)Using Segmented Sweep to Monitor the Cellular Activity of a cdmaOne BandUsing Segmented Sweep (ESA-E Series Spectrum Analyzers)Step 7.Locate the frequency of the cdmaOne signal with a marker:Press Marker, then rotate front-panel ...

  • Page 110

    110Chapter 12 Using Segmented Sweep (ESA-E Series Spectrum Analyzers)Using Segmented Sweep to Monitor the Cellular Activity of a cdmaOne BandUsing Segmented Sweep (ESA-E Series Spectrum Analyzers)

  • Page 111

    111Stimulus Response Measurements (ESA Options 1DN and 1DQ)13Stimulus Response Measurements (ESA Options 1DN and 1DQ)

  • Page 112

    112Chapter 13 Stimulus Response Measurements (ESA Options 1DN and 1DQ)Making a Stimulus Response Transmission MeasurementStimulus Response Measurements (ESA Options 1DN and 1DQ)Making a Stimulus Response Transmission MeasurementThe procedure below describes how to use a built-in tracking generato...

  • Page 113

    Chapter 13113Stimulus Response Measurements (ESA Options 1DN and 1DQ)Making a Stimulus Response Transmission MeasurementStimulus Response Measurements (ESA Options 1DN and 1DQ)Step 5.Put the sweep time into stimulus response auto coupled mode:Press Sweep, Swp Coupling (SR). Step 6.Increase measur...

  • Page 114

    114Chapter 13 Stimulus Response Measurements (ESA Options 1DN and 1DQ)Calculating the N dB Bandwidth Using Stimulus ResponseStimulus Response Measurements (ESA Options 1DN and 1DQ)Calculating the N dB Bandwidth Using Stimulus ResponseThis procedure uses the tracking generator for transmission sti...

  • Page 115

    Chapter 13115Stimulus Response Measurements (ESA Options 1DN and 1DQ)Calculating the N dB Bandwidth Using Stimulus ResponseStimulus Response Measurements (ESA Options 1DN and 1DQ)Step 5.Put the sweep time of the analyzer into stimulus response auto coupled mode:Press Sweep, Swp Coupling (SR). Aut...

  • Page 116

    116Chapter 13 Stimulus Response Measurements (ESA Options 1DN and 1DQ)Measuring Stop Band Attenuation Using Log Sweep (ESA-E Series)Stimulus Response Measurements (ESA Options 1DN and 1DQ)Measuring Stop Band Attenuation Using Log Sweep (ESA-E Series)When measuring filter characteristics, it is us...

  • Page 117

    Chapter 13117Stimulus Response Measurements (ESA Options 1DN and 1DQ)Measuring Stop Band Attenuation Using Log Sweep (ESA-E Series)Stimulus Response Measurements (ESA Options 1DN and 1DQ)Step 7.Put the sweep time into stimulus response auto coupled mode:Press Sweep, Swp Coupling (SR). Adjust the ...

  • Page 118

    118Chapter 13 Stimulus Response Measurements (ESA Options 1DN and 1DQ)Making a Reflection Calibration MeasurementStimulus Response Measurements (ESA Options 1DN and 1DQ)Making a Reflection Calibration MeasurementThe following procedure makes a reflection measurement using a coupler or directional...

  • Page 119

    Chapter 13119Stimulus Response Measurements (ESA Options 1DN and 1DQ)Making a Reflection Calibration MeasurementStimulus Response Measurements (ESA Options 1DN and 1DQ)Step 5.Turn on the tracking generator and set the output power to –10 dBm:Press Source, Amplitude (On), –10, dBm.CAUTIONExces...

  • Page 120

    120Chapter 13 Stimulus Response Measurements (ESA Options 1DN and 1DQ)Measuring Return Loss using the Reflection Calibration RoutineStimulus Response Measurements (ESA Options 1DN and 1DQ)Measuring Return Loss using the Reflection Calibration RoutineThis procedure uses the reflection calibration ...

  • Page 121

    121Demodulating and Viewing Television Signals (ESA-E Series OptionB7B)14Demodulating and Viewing Television Signals (ESA-E Series Option B7B)

  • Page 122

    122Chapter 14 Demodulating and Viewing Television Signals (ESA-E Series Option B7B)Demodulating and Viewing Television SignalsDemodulating and Viewing Television Signals (ESA-E Series OptionB7B)Demodulating and Viewing Television Signals ESA-E Series with option B7B (TV trigger and picture on scr...

  • Page 123

    Chapter 14123Demodulating and Viewing Television Signals (ESA-E Series Option B7B)Demodulating and Viewing Television SignalsDemodulating and Viewing Television Signals (ESA-E Series OptionB7B)When viewing the spectrum, for analog TV channels, there should be a strong, “noise-like” video carr...

  • Page 124

    124Chapter 14 Demodulating and Viewing Television Signals (ESA-E Series Option B7B)Demodulating and Viewing Television SignalsDemodulating and Viewing Television Signals (ESA-E Series OptionB7B)A time domain display of the demodulated TV waveform will now be visible. The signals used for 124, Fig...

  • Page 125

    Chapter 14125Demodulating and Viewing Television Signals (ESA-E Series Option B7B)Demodulating and Viewing Television SignalsDemodulating and Viewing Television Signals (ESA-E Series OptionB7B)Figure 14-2TV Picture DisplayWhen the picture is active, you can adjust the value of the function that w...

  • Page 126

    126Chapter 14 Demodulating and Viewing Television Signals (ESA-E Series Option B7B)Measuring Depth of ModulationDemodulating and Viewing Television Signals (ESA-E Series OptionB7B)Measuring Depth of ModulationThe depth of modulation provides a measure of the percentage of amplitude modulation (AM...

  • Page 127

    Chapter 14127Demodulating and Viewing Television Signals (ESA-E Series Option B7B)Measuring Depth of ModulationDemodulating and Viewing Television Signals (ESA-E Series OptionB7B)Step 6.Enable a delta marker and using the front-panel knob move the delta marker within the white level (NTSC or PAL ...

  • Page 128

    128Chapter 14 Demodulating and Viewing Television Signals (ESA-E Series Option B7B)Measuring Depth of ModulationDemodulating and Viewing Television Signals (ESA-E Series OptionB7B)

  • Page 129

    129Concepts15Concepts

  • Page 130

    130Chapter 15 ConceptsResolving Closely Spaced SignalsConceptsResolving Closely Spaced SignalsResolving Signals of Equal AmplitudeTwo equal-amplitude input signals that are close in frequency can appear as a single signal trace on the analyzer display. Responding to a single-frequency signal, a s...

  • Page 131

    Chapter 15131ConceptsResolving Closely Spaced SignalsConceptsFor best sweep times and keeping the analyzer calibrated set the sweep time (Sweep, Sweep Time) to Auto, and the auto sweep time (Sweep, Auto Sweep Time) to Norm. Use the widest resolution bandwidth that still permits resolution of all ...

  • Page 132

    132Chapter 15 ConceptsHarmonic Distortion CalculationsConceptsHarmonic Distortion CalculationsThe analyzer provides a one-button automated measurement for harmonic measurements (from the second to the tenth harmonic) and provides a calculation of the total harmonic distortion for continuous wave ...

  • Page 133

    Chapter 15133ConceptsTime Gating ConceptsConceptsTime Gating ConceptsIntroduction: Using Time Gating on a Simplified Digital Radio SignalThis section shows you the concepts of using time gating on a simplified digital radio signal. 57,“Making Time-Gated 57, Measurements 57,” 57, on 57, page ...

  • Page 134

    134Chapter 15 ConceptsTime Gating ConceptsConceptsFigure 15-3 Frequency Spectra of the Combined Radio Signals Time gating allows you to see the separate spectrum of radio 1 or radio 2 to determine the source of the spurious signal, as shown in 134,Figure 134, 15-4.Figure 15-4 Time-Gated Spectrum...

  • Page 135

    Chapter 15135ConceptsTime Gating ConceptsConceptsHow Time Gating Works Time gating is achieved by the spectrum analyzer selectively interrupting the path of the detected signal, with a gate, as shown in 136,Figure 136, 15-7 136, and 137,Figure 137, 15-8. The gate determines the times at which i...

  • Page 136

    136Chapter 15 ConceptsTime Gating ConceptsConceptsGated LO Concepts (PSA Spectrum Analyzers)Gated LO is a very sophisticated type of time gating that sweeps the LO only while the gate is “on” and the gate is passing a signal. See 136,Figure 136, 136,15-7 for a simplified block diagram of ga...

  • Page 137

    Chapter 15137ConceptsTime Gating ConceptsConceptsWith video gating the analyzer is continually sweeping, independent of the position and length of the gate. The analyzer must be swept at a minimum sweep time (see the sweep time calculations later in this chapter) to capture the signal when the ga...

  • Page 138

    138Chapter 15 ConceptsTime Gating ConceptsConceptsFigure 15-9 Gated FFT Timing DiagramTime Gating Basics (Gated LO and Gated Video)The gate passes or blocks a signal with the following conditions:• Trigger condition - Usually an external transistor-transistor logic (TTL) periodic signal for edg...

  • Page 139

    Chapter 15139ConceptsTime Gating ConceptsConcepts• The gate trigger signal (a periodic TTL level signal). • The gate signal. This TTL signal is low when the gate is "off" (blocking) and high when the gate is "on" (passing).The timing interactions between the three signals ...

  • Page 140

    140Chapter 15 ConceptsTime Gating ConceptsConceptsFigure 15-11 Signal within pulse #1 (time-domain view)Figure 15-12 Using Time Gating to View Signal 1 (spectrum view)Moving the gate so that it is positioned over the middle of signal 2 produces a result as shown 140,in Figure 15-14. Here, you se...

  • Page 141

    Chapter 15141ConceptsTime Gating ConceptsConceptsMeasuring a Complex/Unknown SignalNOTEThe steps below help to determine the spectrum analyzer settings when using time gating. The steps apply to the time gating approaches using gated LO on the PSA and gated video on the ESA. This example shows yo...

  • Page 142

    142Chapter 15 ConceptsTime Gating ConceptsConceptsFigure 15-15 Time-domain Parameters 142,In Figure 142, 15-15, the parameters are:• Pulse repetition interval (PRI) is 5 ms.• Pulse width (τ) is 3 ms.• Signal delay (SD) is 1 ms for positive edge trigger (0.8 ms for negative edge trigger)....

  • Page 143

    Chapter 15143ConceptsTime Gating ConceptsConceptsView/Trace (ESA) or Trace/View (PSA) menu) to determine the frequency of peak energy.To optimize measurement speed, set the span narrow enough so that the display will still show the signal characteristics you want to measure. For example, if you w...

  • Page 144

    144Chapter 15 ConceptsTime Gating ConceptsConceptsFigure 15-17 Best Position for Gate As a general rule, you will obtain the best measurement results if you position the gate relatively late within the signal of interest, but without extending the gate over the trailing pulse edge or signal trans...

  • Page 145

    Chapter 15145ConceptsTime Gating ConceptsConceptsStep 5. The resolution bandwidth will need to be adjusted for gated LO and gated video. The video bandwidth will only need to be adjusted for gated video.Resolution Bandwidth:The resolution bandwidth you can choose is determined by the gate positio...

  • Page 146

    146Chapter 15 ConceptsTime Gating ConceptsConceptsReducing the video-bandwidth filter too fast causes the signal to appear to drop in amplitude on the screen.If you are in doubt about the proper video bandwidth to choose, set it to its maximum and reduce it gradually until the detected signal lev...

  • Page 147

    Chapter 15147ConceptsTime Gating ConceptsConcepts"Quick Rules" for Making Time-Gated Measurements This section summarizes the rules described in the previous sections.Table 15-1 Determining Spectrum Analyzer Settings for Viewing a Pulsed RF Signal Spectrum Analyzer Function Spectrum Ana...

  • Page 148

    148Chapter 15 ConceptsTime Gating ConceptsConceptsFigure 15-20 Gate Positioning Parameters Most control settings are determined by two key parameters of the signal under test: the pulse repetition interval (PRI) and the pulse width (τ). If you know these parameters, you can begin by picking some...

  • Page 149

    Chapter 15149ConceptsTime Gating ConceptsConceptsNOTE 149,Table 15-3 below applies only to ESA spectrum analyzers. PSA gated LO time gating is not affected by analyzer sweep times (unless the sweep time is set too fast, Meas Uncal appears on the screen and the sweep time will need to be increased...

  • Page 150

    150Chapter 15 ConceptsTime Gating ConceptsConceptsErratic analyzer trace with dropouts that are not removed by increasing analyzer sweep time; oscilloscope view of gate output signal jumps erratically in time domain.Gate Delay may be greater than trigger repetition interval.Reduce Gate Delay unti...

  • Page 151

    Chapter 15151ConceptsTime Gating ConceptsConceptsUsing the Edge Mode or Level Mode for Triggering NOTEPSA spectrum analyzers use edge mode triggering. ESA spectrum analyzers can use edge or level triggering modes.Depending on the trigger signal that you are working with, you can trigger the gate ...

  • Page 152

    152Chapter 15 ConceptsTime Gating ConceptsConceptsNoise Measurements Using Time GatingTime gating can be used to measure many types of signals. However, they must be repetitive and for ESA, have a TTL timing trigger signal available to synchronize the gate. Noise is not a repetitive signal, so if...

  • Page 153

    Chapter 15153ConceptsTrigger ConceptsConceptsTrigger ConceptsSelecting a TriggerNOTEIf you are using an ESA with firmware revision A.07.xx or lower, you can use video and external triggering as set up below in numbers 1 and 2. If you have firmware A.08.xx or later and Option B7E with board part n...

  • Page 154

    154Chapter 15 ConceptsTrigger ConceptsConceptsTV TriggerTV Trigger Setup Menu Functions• TV SourceWhen TV Source is set to SA, the analyzer demodulates the TV signal, by using the analyzer as a fixed tuned receiver. This allows stable, zero span sweeps of the baseband video waveform (band limit...

  • Page 155

    Chapter 15155ConceptsTrigger ConceptsConcepts• FieldA television image or frame is composed of 525 (or 625 lines) delivered in two successive fields of 262.5 (or 312.5 lines) interlaced together on a CRT when displayed.When Field is set to Entire Frame, the line count starts at line one in fiel...

  • Page 156

    156Chapter 15 ConceptsTrigger ConceptsConceptsTrigger Settings and Fast Time Domain SweepsTrigger delay can be used to move the sweep trigger point arbitrarily across a given TV line or lines to allow closer examination of waveform patterns (Press Trig, Trig Delay, and enter a delay time).In fast...

  • Page 157

    Chapter 15157ConceptsAM and FM Demodulation ConceptsConceptsAM and FM Demodulation ConceptsDemodulating an AM Signal Using the Analyzer as a Fixed Tuned Receiver (Time-Domain)The zero span mode can be used to recover amplitude modulation on a carrier signal. The following functions establish a cl...

  • Page 158

    158Chapter 15 ConceptsStimulus Response Measurement ConceptsConceptsStimulus Response Measurement ConceptsNOTEStimulus response measurements require option 1DN or 1DQ with ESA spectrum analyzers.Stimulus Response OverviewStimulus response measurements require a source to stimulate a device under ...

  • Page 159

    Chapter 15159ConceptsStimulus Response Measurement ConceptsConcepts• Source attenuation may be set incorrectly (select Attenuation (Auto) for optimum setting). • The source power may be set too high or too low, use Amplitude (Off) then Amplitude (On) to reset it. • The source power sweep ma...

  • Page 160

    160Chapter 15 ConceptsStimulus Response Measurement ConceptsConceptsReconnect the DUT to the analyzer. Note that the units of the reference level have changed to dB, indicating that this is now a relative measurement. Change the normalized reference position:Press View/Trace, More, Normalize, Nor...

  • Page 161

    Chapter 15161ConceptsStimulus Response Measurement ConceptsConceptsWhere: RL is the measured return loss value.VSWR is sometimes stated as a ratio. For example: 1.2:1 “one point two to one” VSWR. The first number is the VSWR value taken from the table or calculated using the formula. The seco...

  • Page 162

    162Chapter 15 ConceptsStimulus Response Measurement ConceptsConcepts

  • Page 163

    163ESA/PSA Programming Examples16ESA/PSA Programming Examples

  • Page 164

    164Chapter 16 ESA/PSA Programming ExamplesExamples Included in this Chapter:ESA/PSA Programming ExamplesExamples Included in this Chapter:The following C and Visual Basic examples work with both the ESA Series and the PSA Series of spectrum analyzers. There is also a section on programming in C u...

  • Page 165

    Chapter 16165ESA/PSA Programming ExamplesFinding Additional Examples and More InformationESA/PSA Programming ExamplesFinding Additional Examples and More InformationThese examples are available on the Agilent Technologies PSA Series documentation CD-ROM or the ESA Series documentation CD-ROM. The...

  • Page 166

    166Chapter 16 ESA/PSA Programming ExamplesProgramming Examples Information and RequirementsESA/PSA Programming ExamplesProgramming Examples Information and Requirements• The programming examples were written for use on an IBM compatible PC.• The programming examples use C, Visual Basic and VE...

  • Page 167

    Chapter 16167ESA/PSA Programming ExamplesProgramming in C Using the VTLESA/PSA Programming ExamplesProgramming in C Using the VTLThe C programming examples that are provided are written using the C programming language and the Agilent VTL (VISA transition library). This section includes some basi...

  • Page 168

    168Chapter 16 ESA/PSA Programming ExamplesProgramming in C Using the VTLESA/PSA Programming ExamplesTypical Example Program ContentsThe following is a summary of the VTL function calls used in the example programs.visa.h This file is included at the beginning of the file to provide the function ...

  • Page 169

    Chapter 16169ESA/PSA Programming ExamplesProgramming in C Using the VTLESA/PSA Programming ExamplesLinking to VTL LibrariesYour application must link to one of the VTL import libraries:32-bit Version:C:\VXIPNP\WIN95\LIB\MSC\VISA32.LIB for Microsoft compilersC:\VXIPNP\WIN95\LIB\BC\VISA32.LIB for B...

  • Page 170

    170Chapter 16 ESA/PSA Programming ExamplesProgramming in C Using the VTLESA/PSA Programming Examples6. Click on the Add button and type in the following: C:\VXIPNP\WIN95\LIB\MSCFor Borland C++ version 4.0 compilers:• You may wish to add the include file and library file search paths. They are s...

  • Page 171

    Chapter 16171ESA/PSA Programming ExamplesProgramming in C Using the VTLESA/PSA Programming ExamplesExample ProgramThis example program queries a GPIB device for an identification string and prints the results. Note that you must change the address./*idn.c - program filename */#include "visa....

  • Page 172

    172Chapter 16 ESA/PSA Programming ExamplesProgramming in C Using the VTLESA/PSA Programming ExamplesOpening a SessionA session is a channel of communication. Sessions must first be opened on the default resource manager, and then for each device you will be using. The following is a summary of se...

  • Page 173

    Chapter 16173ESA/PSA Programming ExamplesProgramming in C Using the VTLESA/PSA Programming ExamplesThe session returned from viOpenDefaultRM must be used in the sesn parameter of the viOpen function. The viOpen function then uses that session and the device address specified in the rsrcName param...

  • Page 174

    174Chapter 16 ESA/PSA Programming ExamplesProgramming in C Using the VTLESA/PSA Programming ExamplesAddressing a SessionAs seen in the previous section, the rsrcName parameter in the viOpen function is used to identify a specific device. This parameter is made up of the VTL interface name and the...

  • Page 175

    Chapter 16175ESA/PSA Programming ExamplesProgramming in C Using the VTLESA/PSA Programming ExamplesThe following is an example of opening a device session with the GPIB device at primary address23.ViSession defaultRM, vi;..viOpenDefaultRM (&defaultRM);viOpen (defaultRM, "GPIB0::23::INSTR...

  • Page 176

    176Chapter 16 ESA/PSA Programming ExamplesUsing C to Make a Power Suite ACPR Measurement on a cdmaOne SignalESA/PSA Programming ExamplesUsing C to Make a Power Suite ACPR Measurement on a cdmaOne SignalThis C programming example (ACPR.c) can be found on the Documentation CD.Example:/*************...

  • Page 177

    Chapter 16177ESA/PSA Programming ExamplesUsing C to Make a Power Suite ACPR Measurement on a cdmaOne SignalESA/PSA Programming Examplesint iSwpPnts = 401;double freq,value;static ViChar *cToken ;long lCount=0L;char sTraceInfo [1024]= {0};FILE *fDataFile; unsigned long lBytesRetrieved;char *psaSe...

  • Page 178

    178Chapter 16 ESA/PSA Programming ExamplesUsing C to Make a Power Suite ACPR Measurement on a cdmaOne SignalESA/PSA Programming ExamplesviQueryf(viPSA,"%s\n", "%#t","READ:ACP?;*wai" , &iNum , cResult);/*Remove the "," from the ASCII data for analyzing d...

  • Page 179

    Chapter 16179ESA/PSA Programming ExamplesUsing C to Serial Poll the Analyzer to Determine when an Auto-alignment isCompleteESA/PSA Programming ExamplesUsing C to Serial Poll the Analyzer to Determine when an Auto-alignment is CompleteThis C programming example (SerAlign.c) can be found on the Doc...

  • Page 180

    180Chapter 16 ESA/PSA Programming ExamplesUsing C to Serial Poll the Analyzer to Determine when an Auto-alignment is CompleteESA/PSA Programming Exampleslong lResult = 0;long lOpc = 0;char cEnter = 0;/*open session to GPIB device at address 18 */viStatus=viOpenDefaultRM (&defaultRM);viStatus=...

  • Page 181

    Chapter 16181ESA/PSA Programming ExamplesUsing C to Serial Poll the Analyzer to Determine when an Auto-alignment isCompleteESA/PSA Programming Examplesprintf("Performing self-alignment.\n");/* Serial pole the instrument for operation complete */while(1){viQueryf(viPSA,"*ESR?\n"...

  • Page 182

    182Chapter 16 ESA/PSA Programming ExamplesUsing C and Service Request (SRQ) to Determine When a Measurement is CompleteESA/PSA Programming ExamplesUsing C and Service Request (SRQ) to Determine When a Measurement is CompleteThis C programming example (SRQ.c) can be found on the Documentation CD./...

  • Page 183

    Chapter 16183ESA/PSA Programming ExamplesUsing C and Service Request (SRQ) to Determine When a Measurement isCompleteESA/PSA Programming Examples***************************************************************************/ #include <stdio.h>#include <windows.h>#include "visa.h&qu...

  • Page 184

    184Chapter 16 ESA/PSA Programming ExamplesUsing C and Service Request (SRQ) to Determine When a Measurement is CompleteESA/PSA Programming Examples/* Make sure it is an SRQ event, ignore if stray event*/if (eventType!=VI_EVENT_SERVICE_REQ){printf ("\n Stray event type0x%1x\n",eventType)...

  • Page 185

    Chapter 16185ESA/PSA Programming ExamplesUsing C and Service Request (SRQ) to Determine When a Measurement isCompleteESA/PSA Programming Examples/*Program Variables*/ViStatus viStatus = 0;long lOpc=0;/* Open a GPIB session at address 18*/viStatus=viOpenDefaultRM(&defaultRM);viStatus=viOpen...

  • Page 186

    186Chapter 16 ESA/PSA Programming ExamplesUsing C and Service Request (SRQ) to Determine When a Measurement is CompleteESA/PSA Programming Examples/*Initiate a sweep*/viPrintf(viSA,"INIT:IMM\n");/*Make sure the previous command has been completed*/viQueryf(viSA, "*OPC?\n", &qu...

  • Page 187

    Chapter 16187ESA/PSA Programming ExamplesUsing C and Service Request (SRQ) to Determine When a Measurement isCompleteESA/PSA Programming Examplesdone.\n");/*Initiate the sweeps and set the *OPC bit after the sweeps are completed*/viPrintf(viSA,":INIT:IMM;*OPC\n");/*Wait for SRQ */W...

  • Page 188

    188Chapter 16 ESA/PSA Programming ExamplesUsing Visual Basic® 6 to Capture a Screen ImageESA/PSA Programming ExamplesUsing Visual Basic® 6 to Capture a Screen ImageThis is a Visual Basic example that stores the current screen image on your PC. The program works with the ESA or PSA Series spectr...

  • Page 189

    Chapter 16189ESA/PSA Programming ExamplesUsing Visual Basic® 6 to Capture a Screen ImageESA/PSA Programming Examples’’ declarations needed to make VISA calls from Visual Basic.’’ To add this module to your project in VB 6, from the menu, select’’ Project->Add Module, select the ...

  • Page 190

    190Chapter 16 ESA/PSA Programming ExamplesUsing Visual Basic® 6 to Capture a Screen ImageESA/PSA Programming Examples Dim headerlength As Long ’length of header ’Set the default number of bytes that will be contained in the ’ResultsArray to 50,000 (50kB) length = 50000 ...

  • Page 191

    Chapter 16191ESA/PSA Programming ExamplesUsing Visual Basic® 6 to Capture a Screen ImageESA/PSA Programming Examples ’Delete the tempory file on the flash named C:PICTURE.GIF status = viVPrintf(vi, ":MMEM:DEL ’C:PICTURE.GIF’" + Chr$(10), 0) If (status < 0) Then GoTo V...

  • Page 192

    192Chapter 16 ESA/PSA Programming ExamplesUsing Visual Basic® 6 to Transfer Binary Trace DataESA/PSA Programming ExamplesUsing Visual Basic® 6 to Transfer Binary Trace DataThis is a Visual Basic example that gets binary trace data from the instrument. Binary data transfers are faster than the d...

  • Page 193

    Chapter 16193ESA/PSA Programming ExamplesUsing Visual Basic® 6 to Transfer Binary Trace DataESA/PSA Programming Examples’’ declarations needed to make VISA calls from Visual Basic.’’ To add this module to your project in VB 6, from the menu, select’’ Project->Add Module, select th...

  • Page 194

    194Chapter 16 ESA/PSA Programming ExamplesUsing Visual Basic® 6 to Transfer Binary Trace DataESA/PSA Programming Examples Dim ResultsArray(8192) As Single ’trace element array of Real,32 values ’For Real,64 data use Double. For Int,32 data use Long Dim length As Long ’Number ...

  • Page 195

    Chapter 16195ESA/PSA Programming ExamplesUsing Visual Basic® 6 to Transfer Binary Trace DataESA/PSA Programming Examples ’Print the IDN string results in a message box MsgBox (strRes) ’Change the instrument mode to Spectrum Analysis status = viVPrintf(vi, ":INST:NSEL 1&q...

  • Page 196

    196Chapter 16 ESA/PSA Programming ExamplesUsing Visual Basic® 6 to Transfer Binary Trace DataESA/PSA Programming Examples output = output & ResultsArray(x) & vbCrLf Next x ’Print Results to the Screen MsgBox (output) ’Store the results in a text file fnum ...

  • Page 197

    Chapter 16197ESA/PSA Programming ExamplesUsing Agilent VEE to Transfer Trace DataESA/PSA Programming ExamplesUsing Agilent VEE to Transfer Trace DataThis VEE programming example transfers trace data from a PSA or ESA series spectrum analyzer. The program supports data transfer types to integer 32...

  • Page 198

    198Chapter 16 ESA/PSA Programming ExamplesUsing Agilent VEE to Transfer Trace DataESA/PSA Programming Examples

  • Page 199

    199ESA Programming Examples17ESA Programming Examples

  • Page 200

    200Chapter 17 ESA Programming ExamplesExamples Included in this Chapter:ESA Programming ExamplesExamples Included in this Chapter:This chapter includes C programming examples of how to program the ESA series using SCPI commands. Twelve examples are written for ESA analyzers with GPIB interface (O...

  • Page 201

    Chapter 17201ESA Programming ExamplesProgramming Examples System RequirementsESA Programming ExamplesProgramming Examples System RequirementsThe ESA Series examples were written for use on an IBM compatible PC configured as follows:•Pentium processor•Windows 95/98/2000/XP or Windows NT 4.0 op...

  • Page 202

    202Chapter 17 ESA Programming ExamplesUsing C with Marker Peak Search and Peak Excursion Measurement RoutinesESA Programming ExamplesUsing C with Marker Peak Search and Peak Excursion Measurement RoutinesThis C programming example (mkpksrch.c) can be found on the Documentation CD./**************...

  • Page 203

    Chapter 17203ESA Programming ExamplesUsing C with Marker Peak Search and Peak Excursion MeasurementRoutinesESA Programming Examples#include <stdio.h>#include <stdlib.h>#include <math.h>#include <conio.h>#include <ctype.h>#include <string.h>#include "visa.h...

  • Page 204

    204Chapter 17 ESA Programming ExamplesUsing C with Marker Peak Search and Peak Excursion Measurement RoutinesESA Programming Examples{/*Program Variables*/ViStatus viStatus = 0;double dMarkerFreq = 0;double dMarkerAmpl = 0;float fPeakExcursion =0;long lOpc = 0L;/*Open a GPIB session at address 1...

  • Page 205

    Chapter 17205ESA Programming ExamplesUsing C with Marker Peak Search and Peak Excursion MeasurementRoutinesESA Programming Examples/*Set the peak thresold */viPrintf(viESA,"CALC:MARK:PEAK:THR -90 \n");/*Trigger a sweep and wait for completion*/viPrintf(viESA,"INIT:IMM;*WAI\n")...

  • Page 206

    206Chapter 17 ESA Programming ExamplesUsing C for Marker Delta Mode and Marker Minimum Search FunctionsESA Programming ExamplesUsing C for Marker Delta Mode and Marker Minimum Search FunctionsThis C programming example (mkrdelta.c) can be found on the Documentation CD./***************************...

  • Page 207

    Chapter 17207ESA Programming ExamplesUsing C for Marker Delta Mode and Marker Minimum Search FunctionsESA Programming Examples#include <stdlib.h>#include <math.h>#include <conio.h>#include <ctype.h>#include <string.h>#include "visa.h"#define hpESA_IDN_E4401...

  • Page 208

    208Chapter 17 ESA Programming ExamplesUsing C for Marker Delta Mode and Marker Minimum Search FunctionsESA Programming ExamplesViStatus viStatus = 0;double dStartFreq =0.0;double dStopFreq =0.0;double dMarkerAmplitude = 0.0;long lOpc =0L;/* Open an GPIB session at address 18*/viStatus=viOpenD...

  • Page 209

    Chapter 17209ESA Programming ExamplesUsing C for Marker Delta Mode and Marker Minimum Search FunctionsESA Programming ExamplesviPrintf(viESA,"INIT:IMM;*WAI\n");/*Set the marker to the maximum peak*/viPrintf(viESA,"CALC:MARK:MAX\n");/*Set the analyzer to activate delta marker...

  • Page 210

    210Chapter 17 ESA Programming ExamplesUsing C to Perform Internal Self-AlignmentESA Programming ExamplesUsing C to Perform Internal Self-AlignmentThis C programming example (intalign.c) can be found on the Documentation CD./************************************************************//* Performin...

  • Page 211

    Chapter 17211ESA Programming ExamplesUsing C to Perform Internal Self-AlignmentESA Programming Examples#define hpESA_IDN_E4401B "Hewlett-Packard, E4401B"#define hpESA_IDN_E4411B "Hewlett-Packard, E4411B"#definehpEMC_IDN_E7401A "Hewlett-Packard, E7401A"ViSession de...

  • Page 212

    212Chapter 17 ESA Programming ExamplesUsing C to Perform Internal Self-AlignmentESA Programming ExamplesviStatus=viOpenDefaultRM(&defaultRM);viStatus=viOpen(defaultRM,"GPIB0::18",VI_NULL,VI_NULL,&viESA);if(viStatus){printf("Could not open a session to GPIB device at address...

  • Page 213

    Chapter 17213ESA Programming ExamplesUsing C to Perform Internal Self-AlignmentESA Programming ExamplesviQueryf(viESA, "*OPC?\n", "%d", &lOpc);if (!lOpc){printf("Program Abort! error ocurred: last command was not completed!\n");exit(0);}/*Close the session*/viClo...

  • Page 214

    214Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over GPIB)ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over GPIB)This C programming example (ascigpib.c) can be found on the Documentation CD./*******************************************...

  • Page 215

    Chapter 17215ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over GPIB)ESA Programming Examples/* - Remove the "," from the ACSII data *//* - Save the trace data to an ASCII file */ /* - Close the session ...

  • Page 216

    216Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over GPIB)ESA Programming Examples}}void main(){/*Program Variable*/ViStatus viStatus = 0;/*Dimension cResult to 13 bytes per sweep point, 8192 sweep points maximum*/ ViChar _VI_FAR cResult[106496] = {0};FILE ...

  • Page 217

    Chapter 17217ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over GPIB)ESA Programming ExamplesviPrintf(viESA,"SENS:FREQ:CENT 50 MHz\n");/*Set the analyzer to 50MHz Span*/viPrintf(viESA,"SENS:FREQ:SPAN 50 MHz\n");/*Set the analyzer to single sweep mode *...

  • Page 218

    218Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in a 32-Bit Real Format (over GPIB)ESA Programming ExamplesUsing C to Read Trace Data in a 32-Bit Real Format (over GPIB)This C programming example (32btgpib.c) can be found on the Documentation CD./*********************************...

  • Page 219

    Chapter 17219ESA Programming ExamplesUsing C to Read Trace Data in a 32-Bit Real Format (over GPIB)ESA Programming Examples/* - Remove the "," from the ACSII data *//* - Save the trace data to an ASCII file */ /* - Close the session ...

  • Page 220

    220Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in a 32-Bit Real Format (over GPIB)ESA Programming Examplesvoid main(){ /*Program Variables*/ViStatus viStatus= 0; ViChar _VI_FAR cResult[5000] = {0}; ViReal32 dTraceArray[401] = {0};char cBufferInfo[6]= {0};long lNumberBytes ...

  • Page 221

    Chapter 17221ESA Programming ExamplesUsing C to Read Trace Data in a 32-Bit Real Format (over GPIB)ESA Programming Examples/*which follow represent the number of sweep points multiplied by the number *//*of bytes per point. */iHeaderBytes = 3; /*iDataBytes >3, plus increment for ...

  • Page 222

    222Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in a 32-Bit Real Format (over GPIB)ESA Programming Examplesfprintf(fTraceFile,"The%d trace data points of the spectrum:\n\n",(lNumberBytes/4)); for ( long i=0;i<lNumberBytes/4;i++)fprintf(fTraceFile,"\tAmplitude of...

  • Page 223

    Chapter 17223ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over RS-232)ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over RS-232)This C programming example (ascrs232.c) can be found on the Documentation CD./****************************************...

  • Page 224

    224Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over RS-232)ESA Programming Examples/* - Remove the "," from the ACSII data *//* - Save the trace data to an ASCII file */ /* - Close the session ...

  • Page 225

    Chapter 17225ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over RS-232)ESA Programming Examples}}void main(){/*Program Variable*/ViStatus viStatus = 0;/*Dimension cResult to 13 bytes per sweep point, 8192 sweep points maximum*/ViChar _VI_FAR cResult[106496] = {0};FILE *fT...

  • Page 226

    226Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over RS-232)ESA Programming ExamplesviPrintf(viESA,"SENS:FREQ:CENT 50 MHz\n");/*Set the analyzer to 50MHz Span*/viPrintf(viESA,"SENS:FREQ:SPAN 50 MHz\n");/*set the analyzer to single sweep mod...

  • Page 227

    Chapter 17227ESA Programming ExamplesUsing C to Read Trace Data in an ASCII Format (over RS-232)ESA Programming Examples lCount++; cToken =strtok(NULL,",");if (lCount != iSwpPnts)fprintf(fTraceFile,"\tAmplitude of point[%d] =%s dBm\n",lCount+1,cToken); }fprintf(fTraceF...

  • Page 228

    228Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in a 32-bit Real Format (over RS-232)ESA Programming ExamplesUsing C to Read Trace Data in a 32-bit Real Format (over RS-232)This C programming example (32brs232.c) can be found on the Documentation CD./*****************************...

  • Page 229

    Chapter 17229ESA Programming ExamplesUsing C to Read Trace Data in a 32-bit Real Format (over RS-232)ESA Programming Examples/* - Set VISA timeout to 60 seconds, to allow for slower *//* transfer times caused by higher number of sweep points *//* at low baud rates. ...

  • Page 230

    230Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in a 32-bit Real Format (over RS-232)ESA Programming Examples/* For the analyzers having frequency limits >= 3GHz, prompt the user to*//* connect the amplitude reference output to the input*/printf ("Connect AMPTD REF OUT to...

  • Page 231

    Chapter 17231ESA Programming ExamplesUsing C to Read Trace Data in a 32-bit Real Format (over RS-232)ESA Programming Examples /* Set the input port to the internal 50MHz reference source */Route50MHzSignal();/*Query number of sweep points per trace (firmware revision A.04.00 or later)*//*For f...

  • Page 232

    232Chapter 17 ESA Programming ExamplesUsing C to Read Trace Data in a 32-bit Real Format (over RS-232)ESA Programming Examples{printf("Program Abort! error ocurred: last command was not completed!\n");exit(0);}/*Calculate size of trace record. This will be the sum of HeaderBytes, Number...

  • Page 233

    Chapter 17233ESA Programming ExamplesUsing C to Add Limit LinesESA Programming ExamplesUsing C to Add Limit LinesThis C programming example (limlines.c) can be found on the Documentation CD./************************************************************//* Using Limit Lines ...

  • Page 234

    234Chapter 17 ESA Programming ExamplesUsing C to Add Limit LinesESA Programming Examples/* - Set the input port to the 50 MHz amplitude reference. *//* CAL:SOUR:STAT ON *//* - Check to see if limit line passes or fails. It should *//* pass. ...

  • Page 235

    Chapter 17235ESA Programming ExamplesUsing C to Add Limit LinesESA Programming Exampleselse {/* For the analyzers having frequency limits >= 3GHz, prompt the user*//* to connect the amplitude reference output to the input*/printf ("Connect AMPTD REF OUT to the INPUT \n");printf (&quo...

  • Page 236

    236Chapter 17 ESA Programming ExamplesUsing C to Add Limit LinesESA Programming Examplesexit(0);}/*Clear the instrument*/viClear(viESA);/*Reset the instrument*/viPrintf(viESA,"*RST\n");/* Check for the instrument model number and route the 50MHz signal accordingly*//*Route50MHzSignal();...

  • Page 237

    Chapter 17237ESA Programming ExamplesUsing C to Add Limit LinesESA Programming ExamplesviPrintf(viESA,"CALC:LLINE2:STAT ON\n");/*Set the analyzer to a center frequency of 50 MHz, span to 20 MHz, and resolution bandwidth to 1 MHz.*/ viPrintf(viESA,"SENS:FREQ:CENT 50e6\n");...

  • Page 238

    238Chapter 17 ESA Programming ExamplesUsing C to Add Limit LinesESA Programming Examples/* The limit line test should fail.*/printf ("\n\t Limit Line status after de-activating the 50MHz signal \n");/*Print the limits line result*/printResult();/*Close the session*/viClose(viESA);viClos...

  • Page 239

    Chapter 17239ESA Programming ExamplesUsing C to Measure NoiseESA Programming ExamplesUsing C to Measure NoiseThis C programming example (noise.c) can be found on the Documentation CD./************************************************************//* Measuring Noise ...

  • Page 240

    240Chapter 17 ESA Programming ExamplesUsing C to Measure NoiseESA Programming Examples#include <stdio.h>#include <stdlib.h>#include <math.h>#include <conio.h>#include <ctype.h>#include <string.h>#include "visa.h"#define hpESA_IDN_E4401B "Hewlett...

  • Page 241

    Chapter 17241ESA Programming ExamplesUsing C to Measure NoiseESA Programming Examplesvoid main() {/*Program Variables*/ViStatus viStatus = 0;double dMarkAmp =0.0;long lOpc=0L;/*Open a GPIB session at address 18*/viStatus=viOpenDefaultRM(&defaultRM);viStatus=viOpen(defaultRM,"GPIB0::18&q...

  • Page 242

    242Chapter 17 ESA Programming ExamplesUsing C to Measure NoiseESA Programming Examplesprintf("Program Abort! error ocurred: last command was not completed!\n");exit(0);}/*Set the analyzer in a single sweep mode*/viPrintf(viESA,"INIT:CONT 0 \n");/*Trigger a spectrum measurement...

  • Page 243

    Chapter 17243ESA Programming ExamplesUsing C to Enter Amplitude Correction DataESA Programming ExamplesUsing C to Enter Amplitude Correction DataThis C programming example (amplcorr.c) can be found on the Documentation CD./************************************************************//* Entering A...

  • Page 244

    244Chapter 17 ESA Programming ExamplesUsing C to Enter Amplitude Correction DataESA Programming Examples#define hpESA_IDN_E4401B "Hewlett-Packard, E4401B"#define hpESA_IDN_E4411B "Hewlett-Packard, E4411B"#define hpEMC_IDN_E7401A "Hewlett-Packard, E7401A"ViSession ...

  • Page 245

    Chapter 17245ESA Programming ExamplesUsing C to Enter Amplitude Correction DataESA Programming Exampleslong lFreq=0L;long lAmpltd=1; static ViChar *cToken;/*No of amplitude corrections points */iNoOfPoints = 4;/* Open a GPIB session at address 18*/viStatus=viOpenDefaultRM(&defaultRM);viSta...

  • Page 246

    246Chapter 17 ESA Programming ExamplesUsing C to Enter Amplitude Correction DataESA Programming Examples/*Query the analyzer for its amplitude correction factors */ viQueryf(viESA,"SENS:CORR:CSET1:DATA?" , "%s" , &cResult); /*Remove the "," from the amplitude c...

  • Page 247

    Chapter 17247ESA Programming ExamplesUsing C to Determine if an Error has OccurredESA Programming ExamplesUsing C to Determine if an Error has OccurredThis C programming example (error.c) can be found on the Documentation CD./************************************************************//* Determi...

  • Page 248

    248Chapter 17 ESA Programming ExamplesUsing C to Determine if an Error has OccurredESA Programming Examples/* *ESE 0 *//* STAT:QUES:ENAB 0 *//* STAT:QUES:INT:ENAB 0 *//* ...

  • Page 249

    Chapter 17249ESA Programming ExamplesUsing C to Determine if an Error has OccurredESA Programming ExamplesYIELD;}}printf("\n");}/*Set the input port to 50MHz amplitude reference*/void Route50MHzSignal(){viQueryf(viESA, "*IDN?\n", "%t", &cIdBuff);iResult = (strncm...

  • Page 250

    250Chapter 17 ESA Programming ExamplesUsing C to Determine if an Error has OccurredESA Programming Examplesreturn VI_SUCCESS;}/* When an interrupt occurs, determine which device generated the interrupt (if an instrument other than the ESA generates the interrupt, simply report "Instrum...

  • Page 251

    Chapter 17251ESA Programming ExamplesUsing C to Determine if an Error has OccurredESA Programming Examplesprintf("Could not open a session to GPIB device at address 18!\n");exit(0);}/*Clear the instrument*/viClear(viESA);/*Reset the instrument*/viPrintf(viESA,"*RST\n");/*Clear...

  • Page 252

    252Chapter 17 ESA Programming ExamplesUsing C to Determine if an Error has OccurredESA Programming Examples/*Allow analyzer to sweep several times.*/viPrintf(viESA,"INIT:CONT 1 \n");/*Manually couple sweeptime to 5ms. reduce resolution BW to 30 KHz. "Meas Uncal" should be disp...

  • Page 253

    Chapter 17253ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over GPIB)ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over GPIB)This C programming example (harmgpib.c) can be found on the Documentation CD./**********************************************************...

  • Page 254

    254Chapter 17 ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over GPIB)ESA Programming Examples/* *OPC? *//* - De-activate signal track *//* CALC:MARK:TRCK:STAT OFF *...

  • Page 255

    Chapter 17255ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over GPIB)ESA Programming Examples/* CALC:MARK:MAX *//* Set marker amplitude in volts *//* UNIT:POW V */...

  • Page 256

    256Chapter 17 ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over GPIB)ESA Programming Examples/*Set the input port to the 50MHz amplitude reference for the models*//*E4401B, E4411B, and E7401A*/viPrintf(viESA,"CAL:SOUR:STAT ON \n"); }else {/* For the analyzers having f...

  • Page 257

    Chapter 17257ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over GPIB)ESA Programming ExampleslMaxHarmonic =5;dFundamental =50.0;/* Open a GPIB session at address 18*/viStatus=viOpenDefaultRM(&defaultRM);viStatus=viOpen(defaultRM,"GPIB0::18",VI_NULL,VI_NULL,&viE...

  • Page 258

    258Chapter 17 ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over GPIB)ESA Programming ExamplesviPrintf(viESA,"CALC:MARK:SET:RLEV \n"); /*Trigger a sweep, wait for sweep completion*/viPrintf(viESA,"INIT:IMM;*WAI\n");/*Perform a peak search */viPrintf(viESA,&qu...

  • Page 259

    Chapter 17259ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over GPIB)ESA Programming Examples/*Read the marker frequency. */viQueryf(viESA,"CALC:MARK:X? \n","%lf",&dMarkerFreq);dFundamental = dMarkerFreq; /*Measure each harmonic amplitude as follows: */fo...

  • Page 260

    260Chapter 17 ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over GPIB)ESA Programming Examples/*Query and read the Marker Amplitude in Volts*//*Store the result in the array.*/viQueryf(viESA,"CALC:MARK:Y?\n","%1f", &fHarmV[lNum]);/*Change the amplitude un...

  • Page 261

    Chapter 17261ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over RS-232)ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over RS-232)This C programming example (harmrs23.c) can be found on the Documentation CD./******************************************************...

  • Page 262

    262Chapter 17 ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over RS-232)ESA Programming Examples/* *OPC? *//* - De-activate signal track *//* CALC:MARK:TRCK:STAT OFF ...

  • Page 263

    Chapter 17263ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over RS-232)ESA Programming Examples/* CALC:MARK:MAX *//* Set marker amplitude in volts *//* UNIT:POW V ...

  • Page 264

    264Chapter 17 ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over RS-232)ESA Programming Examples/*Set the input port to the 50MHz amplitude reference for the models*//*E4411B, E4401B*/viPrintf(viESA,"CAL:SOUR:STAT ON\n");}else {/* For the analyzers having frequency lim...

  • Page 265

    Chapter 17265ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over RS-232)ESA Programming Examples/*Setting default values*/lMaxHarmonic =5;dFundamental =50.0;/* Open a serial session at COM1 */viStatus=viOpenDefaultRM(&defaultRM);if (viStatus =viOpen(defaultRM,"ASRL1::INS...

  • Page 266

    266Chapter 17 ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over RS-232)ESA Programming Examples/* Place the signal at the reference level using the marker-to-reference level command and take sweep */ viPrintf(viESA,"CALC:MARK:SET:RLEV\n"); /*Trigger a sweep, wait f...

  • Page 267

    Chapter 17267ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over RS-232)ESA Programming ExamplesviQueryf(viESA,"CALC:MARK:Y?\n","%lf",&dFundaAmptdV);/*Read the marker frequency. */viQueryf(viESA,"CALC:MARK:X? \n","%lf",&dMarkerFreq)...

  • Page 268

    268Chapter 17 ESA Programming ExamplesUsing C to Measure Harmonic Distortion (over RS-232)ESA Programming Examples/*Perform a peak search and wait for completion*/viPrintf(viESA,"CALC:MARK:MAX\n");/*Query and read the marker amplitude in Volts*//*Store the result in the fHarmV array.*/v...

  • Page 269

    Chapter 17269ESA Programming ExamplesUsing C to Make Faster Power Averaging MeasurementsESA Programming ExamplesUsing C to Make Faster Power Averaging Measurements This C programming example (average.c) can be found on the Documentation CD./********************************************************...

  • Page 270

    270Chapter 17 ESA Programming ExamplesUsing C to Make Faster Power Averaging MeasurementsESA Programming Examples/* DISP:ENAB OFF */ /* - Select internal machine binary data format (milli-dBm) */ /* FORM:DAT INT,32 ...

  • Page 271

    Chapter 17271ESA Programming ExamplesUsing C to Make Faster Power Averaging MeasurementsESA Programming Examples#define DATA_LENGTH 4 /* number of data bytes in one trace point */#define MAX_POINTS 8192 /* maximum number of points/trace in ESA */ in...

  • Page 272

    272Chapter 17 ESA Programming ExamplesUsing C to Make Faster Power Averaging MeasurementsESA Programming Examples***********************/int HeaderLength(int iArrayLength) { int iHeaderLength; iHeaderLength = 3; /* iArrayLength >0 plus increment for "#" and ...

  • Page 273

    Chapter 17273ESA Programming ExamplesUsing C to Make Faster Power Averaging MeasurementsESA Programming Examples{/*Set the input port to the 50MHz amplitude reference for the models*//*E4401B, E4411B and E7401A*/viPrintf(viESA,":DISP:WIND:TRAC:Y:RLEV -25 DBM\n");viPrintf(viESA,"CAL...

  • Page 274

    274Chapter 17 ESA Programming ExamplesUsing C to Make Faster Power Averaging MeasurementsESA Programming Examples/**************** Write binary trace data to ESA *******************/void write_binary_trace(char *cScpiCommand, int *ipTraceData) { /* trace data must point ...

  • Page 275

    Chapter 17275ESA Programming ExamplesUsing C to Make Faster Power Averaging MeasurementsESA Programming Examples /* calculate a running dPower-average */ for(iLoop = 0; iLoop < NUM_POINTS; iLoop++) { /* running average of dPower, in ...

  • Page 276

    276Chapter 17 ESA Programming ExamplesUsing C to Make Faster Power Averaging MeasurementsESA Programming Examples viStatus = viOpen(defaultRM,"GPIB0::18",VI_NULL,VI_NULL,&viESA); if(viStatus) { printf("Could not open a session to GPIB device at address 18!\n&qu...

  • Page 277

    277PSA Programming Examples18PSA Programming Examples

  • Page 278

    278Chapter 18 PSA Programming ExamplesExamples Included in this Chapter:PSA Programming ExamplesExamples Included in this Chapter:• 280,“Using C with Marker 280, Peak Search 280, and Peak 280, Excursion 280,Measurement 280, Routines” 280, on page 280, 280• 283,“Using C for 283, Savin...

  • Page 279

    Chapter 18279PSA Programming ExamplesProgramming Examples Information and RequirementsPSA Programming ExamplesProgramming Examples Information and Requirements• The programming examples were written for use on an IBM compatible PC.• The programming examples use C, Visual Basic and LabVIEW pro...

  • Page 280

    280Chapter 18 PSA Programming ExamplesUsing C with Marker Peak Search and Peak Excursion Measurement RoutinesPSA Programming ExamplesUsing C with Marker Peak Search and Peak Excursion Measurement RoutinesThis C programming example (peaksrch.c) can be found on the Documentation CD./***************...

  • Page 281

    Chapter 18281PSA Programming ExamplesUsing C with Marker Peak Search and Peak Excursion MeasurementRoutinesPSA Programming Examplesvoid main(){/*Program Variables*/ViStatus viStatus = 0;char cEnter = 0;int iResult = 0;double dMarkerFreq = 0;double dMarkerAmpl = 0;float fPeakExcursion =0;long lO...

  • Page 282

    282Chapter 18 PSA Programming ExamplesUsing C with Marker Peak Search and Peak Excursion Measurement RoutinesPSA Programming Examples/*User enters the peak excursion value */ printf("\t Enter PEAK EXCURSION level in dBm: ");scanf( "%f",&fPeakExcursion); /*Set the peak exc...

  • Page 283

    Chapter 18283PSA Programming ExamplesUsing C for Saving and Recalling Instrument State DataPSA Programming ExamplesUsing C for Saving and Recalling Instrument State DataThis C programming example (State.c) can be found on the Documentation CD./*****************************************************...

  • Page 284

    284Chapter 18 PSA Programming ExamplesUsing C for Saving and Recalling Instrument State DataPSA Programming Examples/*set the instrument to SA mode*/ viPrintf(viVSA, "INST SA\n");/*reset the instrument */ viPrintf(viVSA, "*RST\n");/*set the input port to the internal 50Mhz ref...

  • Page 285

    Chapter 18285PSA Programming ExamplesUsing C for Saving and Recalling Instrument State DataPSA Programming Examplesprintf("PSA Programming example showing *SAV,*RCL SCPI commands\n");printf("used to save instrument state\n\t\t------------------------");printf("\n\nThe ins...

  • Page 286

    286Chapter 18 PSA Programming ExamplesUsing C for Saving and Recalling Instrument State DataPSA Programming Examples viPrintf(viVSA, "*RST;*wai\n");/*Set the instrument to continuous sweep */ viPrintf(viVSA, "INIT:CONT 1\n");/* close session */viClose (viVSA);viClose (defaultR...

  • Page 287

    Chapter 18287PSA Programming ExamplesUsing C to Save Binary Trace DataPSA Programming ExamplesUsing C to Save Binary Trace DataThis C programming example (Trace.c) can be found on the Documentation CD.This example uses Option B7J./******************************************************************...

  • Page 288

    288Chapter 18 PSA Programming ExamplesUsing C to Save Binary Trace DataPSA Programming ExamplesViReal64 adTraceArray[10240];char *psaSetup =/* setup commands for VSA/PSA */":INST BASIC;"/* Set the instrument mode to Basic */"*RST;*CLS;"/* Reset the device and clear status */&q...

  • Page 289

    Chapter 18289PSA Programming ExamplesUsing C to Save Binary Trace DataPSA Programming Examples/*print message to the standard output*/printf("Getting the spectrum trace in binary format...\nPlease wait...\n\n");/* get number of bytes in length of postceeding trace data and put this in...

  • Page 290

    290Chapter 18 PSA Programming ExamplesUsing C to Save Binary Trace DataPSA Programming ExamplessBuffer[lLength] = 0; /* append a null to byte count */printf("%s\n",sBuffer); /* print error buffer to display */} while (sBuffer[1] != ’0’);/* set t...

  • Page 291

    Chapter 18291PSA Programming ExamplesUsing C to Make a Power Calibration Measurement for a GSM MobileHandsetPSA Programming ExamplesUsing C to Make a Power Calibration Measurement for a GSM Mobile HandsetThis C programming example (powercal.c) can be found on the Documentation CD.This program use...

  • Page 292

    292Chapter 18 PSA Programming ExamplesUsing C to Make a Power Calibration Measurement for a GSM Mobile HandsetPSA Programming Examples* Instrument Requirements:* E444xA with option B7J and firmware version >= A.05.00 or* E4406A with firmware version >= A.07.00 or** Sig...

  • Page 293

    Chapter 18293PSA Programming ExamplesUsing C to Make a Power Calibration Measurement for a GSM MobileHandsetPSA Programming Exampleslong i = 0;long lOpc= 0L;double sweeptime = 0;double burstinterval= 0;unsigned long lBytesRetrieved;ViReal64 adDataArray[100];char sBuffer[80]= {0};c...

  • Page 294

    294Chapter 18 PSA Programming ExamplesUsing C to Make a Power Calibration Measurement for a GSM Mobile HandsetPSA Programming Examples/*check opening session sucess*/if(viStatus){printf("Could not open a session to GPIB device at address 18!\n");exit(0);}/* Set I/O timeout to ten second...

  • Page 295

    Chapter 18295PSA Programming ExamplesUsing C to Make a Power Calibration Measurement for a GSM MobileHandsetPSA Programming Exampleswhile(1){viReadSTB(viVSA,&stb); //read status byteif (stb & 128) break; //look for "waiting for trigger" bitprintf("Waiting on Analyzer...\...

  • Page 296

    296Chapter 18 PSA Programming ExamplesUsing C to Make a Power Calibration Measurement for a GSM Mobile HandsetPSA Programming Examples/* read the terminator character and discard */viRead (viVSA,(ViBuf)sBuffer,1, &lthrowaway); /*print message to the standard output*/printf("Querying ins...

  • Page 297

    Chapter 18297PSA Programming ExamplesUsing C with the CALCulate:DATA:COMPress? RMS CommandPSA Programming ExamplesUsing C with the CALCulate:DATA:COMPress? RMS Command This C programming example (calcomp.c) can be found on the Documentation CD.This program uses the CALCulate:DATA:COMPress? RMS co...

  • Page 298

    298Chapter 18 PSA Programming ExamplesUsing C with the CALCulate:DATA:COMPress? RMS CommandPSA Programming Examples* CALC:DATA0:COMP? RMS parameters:* soffset = 25us (This avoids averaging data points when the burst* is transitioning on.)* length = 526us (...

  • Page 299

    Chapter 18299PSA Programming ExamplesUsing C with the CALCulate:DATA:COMPress? RMS CommandPSA Programming Examples":DISP:ENAB 0;"// Turn the Display off (improves Speed)":FORM REAL,64;"// Set the ouput format to binary":FORM:BORD SWAP;"// set the binary byte order to...

  • Page 300

    300Chapter 18 PSA Programming ExamplesUsing C with the CALCulate:DATA:COMPress? RMS CommandPSA Programming Examples/* Send setup commands to instrument */ viPrintf(viPSA,"%s\n",basicSetup);/* Calculate sweep time and set it*/sweeptime=4.6153846*lbursts;viPrintf(viPSA,":WAV:SWE:TIME...

  • Page 301

    Chapter 18301PSA Programming ExamplesUsing C with the CALCulate:DATA:COMPress? RMS CommandPSA Programming Examples/* get number of bytes in length of postceeding data and put this in sBuffer*/viRead (viPSA,(ViBuf)sBuffer,2,&lBytesRetrieved); /* Put the returned data into sBuffer */viRead (v...

  • Page 302

    302Chapter 18 PSA Programming ExamplesUsing C with the CALCulate:DATA:COMPress? RMS CommandPSA Programming Examples/* Turn the Display of the instrument back on */viPrintf(viPSA,"DISP:ENAB 1\n");/*save result data to an ASCII file*/fDataFile=fopen("C:\\calccomp.txt","w&qu...

  • Page 303

    Chapter 18303PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming ExamplesUsing C Over Socket LAN (UNIX)This C programming example (socketio.c) compiles in the HP-UX UNIX environment. It is portable to other UNIX environments with only minor changes.In UNIX, LAN communication via...

  • Page 304

    304Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples * * Query the center frequency: * lanio 15.4.43.5 ’sens:freq:cent?’ * * Query X and Y values of marker 1 and marker 2 (assumes they are on): * lanio myinst ’calc:spec:mark1:x?;y?; :c...

  • Page 305

    Chapter 18305PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples/* Support both Win32 and HP-UX UNIX environment */#ifdef _WIN32 /* Visual C++ 4.0 will define this */# define WINSOCK#endif#ifndef WINSOCK# ifndef _HPUX_SOURCE# define _HPUX_SOURCE# endif#endif#inc...

  • Page 306

    306Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples#endif /* WINSOCK */#ifdef WINSOCK /* Declared in getopt.c. See example programs disk. */ extern char *optarg; extern int optind; extern int getopt(int argc, char * const argv[], const char* optstrin...

  • Page 307

    Chapter 18307PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples WSADATA wsaData; int err; wVersionRequested = MAKEWORD(1, 1); wVersionRequested = MAKEWORD(2, 0); err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { /*...

  • Page 308

    308Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples * * $Return: (int) . . . . . . . . A file descriptor similar to open(1).$ * * $Errors: returns -1 if anything goes wrong $ * **********************************************************************...

  • Page 309

    Chapter 18309PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples memcpy(&peeraddr_in.sin_addr.s_addr, hostPtr->h_addr, hostPtr->h_length); peeraddr_in.sin_family = AF_INET; peeraddr_in.sin_port = htons((unsigned short)portNumber); if (connect(s, (c...

  • Page 310

    310Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples /* fprintf(stderr, "Sending \"%s\".\n", command); */ if (strchr(command, ’\n’) == NULL) { fprintf(stderr, "Warning: missing newline on command %s.\n", comman...

  • Page 311

    Chapter 18311PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples if (*ptr == ’\n’) { ptr++; err = 0; break; } ptr++; } *ptr = ’\0’; if (err) { return NULL; } else { return re...

  • Page 312

    312Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples * > $Function: queryInstrument$ * * $Description: send a SCPI command to the instrument, return a response.$ * * $Parameters: $ * (FILE *) . . . . . . . . . file pointer associated with TCP/IP so...

  • Page 313

    Chapter 18313PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples ch = tmp_buf[0]; if ((count < 1) || (ch == EOF) || (ch == ’\n’)) { *result = ’\0’; /* null terminate result for ascii */ return 0; } /* use a do-while so we can ...

  • Page 314

    314Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples /* Loop until we get all the bytes we requested. */ /* Each call seems to return up to 1457 bytes, on HP-UX 9.05 */ do { int rcount; ...

  • Page 315

    Chapter 18315PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples if (recv_line(sock, result+1, maxLength-1) == NULL) return 0; /* REMOVE trailing newline, if present. And terminate string. */ resultBytes = strlen(result); if ...

  • Page 316

    316Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples * Don’t bother decoding. ******************************************************************/ if (strncmp(result_str, "+0,", 3) == 0) { /* Matched +0,"No ...

  • Page 317

    Chapter 18317PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples * any command with a ’?’ followed by a ’)’ character. * This kind of command is not a query from our point of view. * The analyzer does the query internally, and uses the re...

  • Page 318

    318Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples char *charBuf = (char *) malloc(INPUT_BUF_SIZE); char *basename; int chr; char command[1024]; char *destination; unsigned char quiet = 0; unsigned char show_errs = 0; int number = ...

  • Page 319

    Chapter 18319PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples strcat(command, " "); } else { strcat(command, "\n"); } } } else { /* Only...

  • Page 320

    320Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples fprintf(stderr, "Unable to open socket.\n"); return 1; } /* fprintf(stderr, "Socket opened.\n"); */ if (strlen(command) > 0) { /********************...

  • Page 321

    Chapter 18321PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples if ( *charBuf == ’#’ || *charBuf == ’!’ ) continue ; strcat(charBuf, "\n"); if (!quiet) { if (number) ...

  • Page 322

    322Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (UNIX)PSA Programming Examples { commandInstrument(instSock, charBuf); } if (number) number++; } } if (show_errs) { showErrors(instSock); }#ifdef WINSOCK close...

  • Page 323

    Chapter 18323PSA Programming ExamplesUsing C Over Socket LAN (Windows NT)PSA Programming ExamplesUsing C Over Socket LAN (Windows NT)This C programming example (getopt.c) compiles in the Windows NT environment. In Windows, the routines send() and recv() must be used, since fread() and fwrite() ma...

  • Page 324

    324Chapter 18 PSA Programming ExamplesUsing C Over Socket LAN (Windows NT)PSA Programming Examples the first call to the function getopt. When all options have been processed (i.e., up to the first non-option argument), getopt returns EOF. The special option -- can be used to ...

  • Page 325

    Chapter 18325PSA Programming ExamplesUsing C Over Socket LAN (Windows NT)PSA Programming Examples optind++; } c = *scan++; posn = strchr(optstring, c); /* DDP */ if (posn == NULL || c == ’:’) { fprintf(stderr, "%s: unknown option -%c\n", argv...

  • Page 326

    326Chapter 18 PSA Programming ExamplesUsing Java Programming Over Socket LANPSA Programming ExamplesUsing Java Programming Over Socket LANThis Java programming example (ScpiDemo.java) demonstrates simple socket programming with Java and can be found on the Documentation CD. It is written in Java ...

  • Page 327

    Chapter 18327PSA Programming ExamplesUsing Java Programming Over Socket LANPSA Programming Examples Panel p; // Initialize the applets public void init() { SetupSockets(); SetupPanels(); // Set up font type for both panels Font font = new Font(&...

  • Page 328

    328Chapter 18 PSA Programming ExamplesUsing Java Programming Over Socket LANPSA Programming Examples public boolean action(Event evt, Object what) { // If this is the correct target if (evt.target == scpiCommand) { // Get the scpi command String str = scpiCo...

  • Page 329

    Chapter 18329PSA Programming ExamplesUsing Java Programming Over Socket LANPSA Programming Examples // Clear the error queue before starting the thread // in case if there’s any error messages from the previous actions while ( str.indexOf("No error") == -1 ) { ...

  • Page 330

    330Chapter 18 PSA Programming ExamplesUsing Java Programming Over Socket LANPSA Programming Examples p.add("West", new Label("SCPI command:")); p.add("Center", scpiCommand); southPanel.add(p); // Set up the Response panel setLayout(...

  • Page 331

    Chapter 18331PSA Programming ExamplesUsing Java Programming Over Socket LANPSA Programming Examples Socks(URL appletB) { appletBase = appletB; // Set up for port array. port[SCPI] = SCPI_PORT; // Initialize the sock array for ( int i = 0; i < MAX_NUM_OF...

  • Page 332

    332Chapter 18 PSA Programming ExamplesUsing Java Programming Over Socket LANPSA Programming Examples } } // Close the socket(s) if opened public void CloseSocket(int s) { try { if ( sockOpen[s] == true ) { // write blank line to exit servers ele...

  • Page 333

    Chapter 18333PSA Programming ExamplesUsing Java Programming Over Socket LANPSA Programming Examples //************* Socket I/O routines. //*** I/O routines for SCPI socket // Write an ASCII string with carriage return to SCPI socket public void ScpiWriteLine(String command) { ...

  • Page 334

    334Chapter 18 PSA Programming ExamplesUsing Java Programming Over Socket LANPSA Programming Examples catch (IOException e) { System.out.println("Scpi Read Byte Error "+e.getMessage()); } return 0; }}

  • Page 335

    Chapter 18335PSA Programming ExamplesUsing the VXI Plug-N-Play Driver in LabVIEW®PSA Programming ExamplesUsing the VXI Plug-N-Play Driver in LabVIEW®This example shows how to use the VXI plug and play driver over LAN in LabVIEW 6. The vi file (lan_pnp.vi) can be found on the Documentation CD.Yo...

  • Page 336

    336Chapter 18 PSA Programming ExamplesUsing LabVIEW® 6 to Make an EDGE GSM MeasurementPSA Programming ExamplesUsing LabVIEW® 6 to Make an EDGE GSM MeasurementThis is a LabVIEW 6 example that uses SCPI commands instead of the instrument driver. It demonstrates reading ASCII trace points of entir...

  • Page 337

    Chapter 18337PSA Programming ExamplesUsing LabVIEW® 6 to Make an EDGE GSM MeasurementPSA Programming Examples

  • Page 338

    338Chapter 18 PSA Programming ExamplesUsing Visual Basic® .NET with the IVI-Com DriverPSA Programming ExamplesUsing Visual Basic® .NET with the IVI-Com DriverThis example uses Visual Basic .NET with the IVI-Com driver. It makes a time domain (Waveform) measurement using the Basic mode. Basic mo...

  • Page 339

    Chapter 18339PSA Programming ExamplesUsing Visual Basic® .NET with the IVI-Com DriverPSA Programming Examples’ Copyright (c) 2003. Agilent Technologies, Inc.’*************************************************************************Option Strict OnImports Agilent.TMFrameworkImports Agilent.Ag...

  • Page 340

    340Chapter 18 PSA Programming ExamplesUsing Visual Basic® .NET with the IVI-Com DriverPSA Programming Examples Dim manufacturer As String Dim model As String Dim firmware As String manufacturer = inherent.Identity.InstrumentManufacturer model = inherent.Identit...

  • Page 341

    Chapter 18341PSA Programming ExamplesUsing Visual Basic® .NET with the IVI-Com DriverPSA Programming Examples Next Catch ex As Exception Console.WriteLine(ex.Message) Finally ’ Close the connection instr.Close() End Try Catch ex As COMException ...

  • Page 342

    342Chapter 18 PSA Programming ExamplesUsing Agilent VEE to Capture the Equivalent SCPI Learn StringPSA Programming ExamplesUsing Agilent VEE to Capture the Equivalent SCPI Learn StringThis example shows how to use VEE to emulate the *LRN SCPI command. The VEE file (lrnstring.vee) can be found on ...

  • Page 343

    Index 343IndexAACPRC programming example 176,176active function position, moving 14,14adding limit lines programming example using C 233, 233adjacent channel power measurement 74, 74Agilent VEE program example 197,197 197,, 342,342alignmentsprogramming example 179,179AM demodulationtime-dom...

  • Page 344

    344 IndexIndexESA-E time gate 64,64PSA gated FFT 66,66PSA gated sweep 62,62trace averaging 30,30tracking a signal 38, 38TV signalsdemodulate and view 122, 122depth of modulation 126,126external mixingentering conversion loss data 85,85preselected mixers, using 86,86setting mixer bias 84,...

  • Page 345

    Index 345IndexC, using ESA 202, 202, 206,206 210,, 210 210,, 214,214 218,, 218, 223,223 228,, 228 228,, 233,233, 239,239 243,, 243 247,, 247, 253,253 253,, 261,261, 269,269C, using PSA 280,280 280,, 283,283, 287,287, 291,291 297,, 297IVI-Com driver 338,338Java 326,326LabVIEW 335,3...

  • Page 346

    346 IndexIndexgated LO (PSA), concepts 136, 136gated video (ESA), concepts 136,136how time gating works 135,135initial settings 148,148keys 143,143positioning the gate 63, 63 143,, 143PSA gated FFT, using 66,66PSA gated sweep, using 62,62rules 147,147setting sweep time 148,148setting the...