Summary of Contents for Agilent Technologies 4396B
Page 1
Agilent 4396B Network/Spectrum/Impedance Analyzer GPIB Programming Guide SERIAL NUMBERS This manual applies directly to instruments with serial number prex JP1KE. For additional important information about serial numbers, read \Serial Number" in Appendix A. Agilent Part No. 04396-90063 Printed in Japan May 2003...
Page 2
This document contains proprietary information that is protected by copyright. All rights are reserved. No part of this document may be photocopied, reproduced, or translated to another language without the prior written consent of the Agilent Technologies. Agilent Technologies Japan, Ltd.
Page 3
Manual Printing History The manual's printing date and part number indicate its current edition. The printing date changes when a new edition is printed. (Minor corrections and updates that are incorporated at reprint do not cause the date to change.) The manual part number changes when extensive technical changes are incorporated.
Page 4
Typeface Conventions Bold Boldface type is used when a term is dened. For example: icons are symbols. Italic type is used for emphasis and for titles of manuals and other Italics publications. Italic type is also used for keyboard entries when a name or a variable must be typed in place of the words in italics.
Page 5
How to Use This Manual This manual provides an introduction to writing BASIC programs for the 4396B Network/Spectrum Analyzer (analyzer). To reduce the time required for you to learn how to write programs for the analyzer, the examples shown in this guide are supplied on sample disks.
Page 6
Option 010 Operating Handbook (Agilent Part Number 04396-900x6 The option 010 Operation Handbook describes the unique impedance measurement functions of the 4396B with option 010. Instrument BASIC Manual Set (Agilent Part Number 04155-90151(E2083-90000)) The Instrument BASIC User's Handbook introduces you to the Instrument BASIC programming language, provide some helpful hints on getting the most use from it, and provide a general programming reference.
Contents 1. Learning GPIB Remote Control Basics Required Equipment ......To Prepare for GPIB Control ......GPIB Commands Introduction .
Page 8
4. Reading Measurement Data To Read Data Using the Marker Search Function ....Search Maximum Value ......Read Data .
Page 9
11-9 File Transfer from 4396B to External Controller ....11-10 File Transfer from External Controller to 4396B ....11-12 Displaying List of Files in Current Directory .
Page 10
Figures 1-1. System Conguration for GPIB Remote Control ....1-2. Program Flow ....... 1-3.
Page 11
11-9. Sample Program: File Transfer from External Controller to 4396B (1/2) ..11-13 11-10. Sample Program: Displaying List of Files in Current Directory of 4396B ..11-15 A-1. Serial Number Plate ......
Page 12
Tables A-1. Manual Changes by Serial Number ..... A-2. Manual Changes by Firmware Version ....Contents-6...
The General Purpose Interface Bus ( ) is used for remote gpib control of the 4396B Network/Spectrum/Impedance Analyzer (analyzer). GPIB is a standard for interfacing instruments to computers and peripherals. This standard supports worldwide standards IEEE 488.1, IEC-625, and IEEE 488.2. The GPIB interface allows the analyzer to be controlled by an external computer.
If you are using only Instrument BASIC and no external controller, prepare the analyzer for your use. For details, see Using Instrument BASIC with the 4396B If you are using a computer as an external controller, a. Set the analyzer to addressable only mode.
Page 15
How large a system A maximum of 15 devices can be connected on one bus system. can you congure? The length of cable between one device and another must be less than or equal to four meters. The total length of cable in one bus system must be less than or equal to two meters times the number of devices connected on the bus (the GPIB controller counts as one device).
GPIB Commands Introduction All the analyzer's front-panel keys have a corresponding GPIB command. By executing an GPIB command, you can operate the analyzer as if you were pressing the corresponding key. For example, Pressing is the same as executing the GPIB command, Preset Note Each of the analyzer's functions has two corresponding GPIB commands:...
To Program a Basic Measurement This section describes how to organize the commands into a measurement sequence. Figure 1-2 shows a typical program
ow for a measurement. Figure 1-2. Program Flow The following program performs the measurement
ow controlling the analyzer using GPIB. This guide shows program lists of sample programs for an external controller.
Figure 1-3. Sample Program : Basic Measurement (2/2) Set I/O Path This operation allows you to use , instead of ), as the GPIB address in the program. Set Up the Measurement Parameters You can execute GPIB commands in the same sequence as key operation. Lines 60 and 70 perform the same operation as pressing NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN Preset...
In lines 80 to 110 (setting frequency), parameters are required with the GPIB command. To set parameters, see \To Execute an GPIB Command with a Parameter" later in this chapter. Perform Calibration In lines 140 to 240, the GPIB program follows the key strokes required to calibrate from the front panel.
Post-Processing Line 380 activates the marker and line 390 moves the marker to the maximum value on the trace. For details on using the marker, see Chapter 4. Transfer Data Line 400 the measured data is transferred to the controller. For details about data transfer, see Chapter 4.
Triggering the Analyzer from Remote This chapter describes how to control the trigger system of the analyzer. To trigger a measurement from a controller, the following steps are commonly used: 1. Set the trigger source to: Bus, or Internal (free run) (In External, Video, Manual or Gate trigger, you cannot trigger from the controller, so these sources are not mentioned in this guide.) 2.
In Figure 2-1, 1. After a GPIB command execution, the analyzer returns to the \Idle" state. 2. By setting the number of measurements, the analyzer changes from the \Idle" state to the \Waiting for Trigger" state. 3. At the \Waiting for Trigger" state, a trigger input (corresponding to the trigger source) starts a measurement.
What can you do to Send the command: abort a measurement? The measurement sweep is aborted. What are other trigger Instead of , you can use, commands? for single measurement parameter for number of group measurements When you transfer measurement data to the controller, you must use either the command to synchronize the controller and the analyzer.
How can you wait for a When you want to return the measurement data to the measurement to be controller, you must wait for the measurement to be completed? completed. For details, see Chapter 3. Figure 2-4. Sample Program : To Trigger a Measurement from Controller (2) Set Trigger Source Set the trigger source to bus.
Synchronizing the Analyzer from Remote GPIB analyzer control programs that can be used for guiding you through an analyzer calibration, and for reading and manipulating measurement data. The control program must wait until the calculation data is processed before continuing with the next instruction.
To W ait For the Preceding Operation to Complete Figure 3-2. Sample Program: To Wait for the Preceding Operation to Complete Let Controller Wait For Operation to Complete (OPC) In line 80, the command waits for the preceding operations to complete and then returns In line 90, the controller pauses the program until the analyzer returns a .
To W ait for Sweep End Figure 3-3. Sample Program : To Wait for Sweep End Enable Sweep-End Bit Line 60 clears all bits of the Status Registers and the Enable Registers. In line 70, the command sets the Service Request Enable Register to 00000100 (this enables bit 2 of the Status Byte Register).
Enable Registers select which events in the analyzer can cause a service request (SRQ). By setting bit 0 of the Event Status Enable Register B to 1, the occurrence of the corresponding event (sweep-end) sets bit 0 of the Event Status Register B. When this bit is set (and is enabled), it is used to set a summary bit in the Status Byte Register (bit 2).
To Report Command Error Occurrence Figure 3-5. Sample Program : To Report Command Error Occurrence For details on SRQ interrupt, see the \To Wait for Sweep End" example. Enable Error Bit Line 70 clears all bits of the Status Registers and Enable Registers. In line 80, the command sets the Service Request Enable Register to 00100000 (this enables bit 5 of the Status Byte Register).
Figure 3-6. Command-Error Bit Enabling Report Command Error If an GPIB command (executed between lines 100 and 160) causes an GPIB command error, the analyzer generates an SRQ and the controller branches to . For example, the statement: Setting center frequency, but no parameter causes an SRQ interrupt and branch to Output Error These commands retrieve the error number and description.
Return to Execute GPIB command Lines 230 to 270 clear SRQ before returning to the main routine. Line 230 reads the analyzer's status byte. The statement reads the Status Byte Register of the address (analyzer), and enters the value into . The command error causes the SRQ and with bit 5 and bit 6 of the Status Byte Register set, the value of is 96.
Reading Measurement Data This chapter describes how to read measurement data over the GPIB. Measurement data can be read out of the analyzer in the following ways: 1. Data can be read o the trace selectively using the markers. The present value of the marker (real-imaginary data and sweep parameter) is retrieved. For additional information on the marker functions, see the Function Reference 2.
To Read Data Using the Marker Search Function Figure 4-1. Sample Program : To Read Data Using Marker Search Function Search Maximum Value Line 190 activates the marker and line 200 moves the marker to the maximum value on the trace.
What are the other You can activate sub-markers and the 1marker using the marker commands? following commands: You can move the marker using the following commands: specied sweep parameter parameter specied measurement point parameter You can move sub-markers using the following commands: specied sweep parameter parameter specied measurement point...
To Get Measurement Trace Using ASCII Format Figure 4-2. Sample Program : To Get Measurement Trace Using ASCII Format Set the Receive Array Line 180 sets the array size to the analyzer's maximum number of measurement points (801). In this example, it is assumed that the analyzer is in the network analyzer mode of operation, in which each point has complex data.
Set Data Transfer Format Line 190 tells the analyzer to use the ASCII transfer format. Read Data retrieves DATA TRACE ARRAYS, and retrieves sweep parameters. In line 210 and 230, you must choose to allow for an insucient number of data points to ll the array (which is 801 as declared in line 180).
To Get Measurement Trace Using Binary Format Two programs are shown to get the data arrays using binary format in Figure 4-3 and Figure 4-5. Figure 4-3 Figure 4-5 For the external controller For the Instrument BASIC Using command (line 220) to allow Instrument BASIC allows for a dierent for the change in the number of number of data points then the number...
Figure 4-3. Sample Program : To Get Measurement Trace Using IEEE 64-bit Floating Point Format (For External Controller) (2/2) This program is similar to the ASCII transfer program. However, you must set the data transfer format OFF when using the binary data transfer format. Set the Receive Array Line 190 sets the array size to the analyzer's maximum number of measurement points (801).
Read Data FORM3 has an eight-byte header to deal with. The rst two bytes are the ASCII characters #6. This indicates that a xed length block transfer follows and that the next 6 bytes form an integer specifying the number of bytes in the block to follow. The header must be read in so that data order is maintained (lines 260 and 300).
Before running the program in Figure 4-5, you must modify the dimension of the data arrays to match the analyzer type (network or spectrum). (See the \Set the Receive Array" below.) Figure 4-5. Sample Program : To Get Measurement Trace Using IEEE 64-bit Floating Point Format (For Instrument BASIC) Set the Receive Array Line 190 sets the array size to the maximum number of data.
If the number of measurement points change, then so does the number of data. Instrument BASIC allows for insucient data in lines 220 to 270 (see \Read Data"). Set Data Transfer Format To use FORM3 the computer must be instructed to stop formatting the incoming data with the statement.
Writing Data Arrays to the Analyzer Chapter 4 explained how to read data arrays from the analyzer. This chapter shows how to write data arrays to the analyzer. You can read, modify, and store the data arrays to the analyzer over the GPIB. This allows you to modify the trace on the analyzer's display. For details on the data arrays in the analyzer, see the manual.
Figure 5-1. Sample Program : To Modify Calibration Data (2/2) This program measures calibration standards, reads the obtained calibration data, and restores the data in the analyzer. For details on how to obtain the calibration data by measuring the standard, see Chapter 1. For details on how to transfer the data arrays, see Chapter 4. Read Calibration Data The controller can read out the error coecients using the GPIB commands Each point is a real/imaginary pair, and the number of points in the array is the same as the...
Modify Calibration Data In this portion of program, you modify the CALIBRATION COEFFICIENT ARRAY, which is contained in Restore Modied Calibration Data Line 440 opens the CALIBRATION COEFFICIENT ARRAY 1 in the analyzer. This array is used to restore the data. Lines 450 and 460 send the le header ( ), calibration data ( ) and the terminator...
Page 46
What is a le header? When using the binary data transfer format, the transferred data must be accompanied by the le header that represents the data length. In this example, the data transfer format is FORM3 and the transferred data is congured as follows: FORM3 Data Transfer Format If you are not reading the header, you can create it using the number of data points.
Redrawing Measurement Trace with Modied Calibration Data When all the calibration coecients are in the analyzer, send the GPIB command to have the analyzer reshape a trace with the coecients. How can you modify To modify the trace on the display, you rewrite the data the trace? (Summary) arrays in the analyzer.
To Modify Error-Corrected Data Figure 5-3. Sample Program : To Modify Error-Corrected Data This program measures the DUT, reads the obtained data, and restores the data in the analyzer. For details on how to read the data array, see Chapter 4. For information on how to modify the trace on the display, see the \To Modify Calibration Data"...
Read Error-Corrected Data command (line 300) retrieves DATA ARRAYS in the analyzer. For details on data transfer, see Chapter 4. Restore Modied Error-Corrected Data Line 380 opens the DATA ARRAYS in the analyzer to restore the data. Lines 390 to 400 transfer data in FORM3 (a similar procedure is used in the \To Modify Calibration Data"...
To Modify Trace Data Figure 5-4. Sample Program : To Modify Trace Data This program measures the DUT, reads the obtained data, and restores the data into the analyzer. For details on how to read the data array, see Chapter 4. For details on how to modify the trace on the display, see the \To Modify Calibration Data"...
Read Trace Data command (line 300) retrieves trace data in the analyzer. For details on data transfer, see Chapter 4. Restore Modied Trace Data Line 380 opens the DATA TRACE ARRAYS in the analyzer to restore the data. Lines 390 and 400 transfer data in FORM3 (a similar procedure is used in the \To Modify Calibration Data"...
Printing or Plotting the Analyzer's Display This chapter describes how to print the information on the analyzer display using GPIB commands. To Print Analyzer Display Printer Preparation 1. Connect a printer using a parallel cable. 2. Turn the printer on. Execute Print To print the screen, execute the folowing command.
Controlling Instrument BASIC from Remote This chapter is for programmers who use both Instrument BASIC and an external controller at the same time. This chapter shows how to pass control and how to use the PROGram subsystem commands. The PROGram subsystem is part of the SCPI commands hierarchy. See manual for more information on how to use SCPI commands.
What is system The controller that acts as the master controller. controller? A controller can be set as either a system controller or a non-system controller. For details on how to set a controller, see the controller's manual. The analyzer, as a controller, can be used in either NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN (system controller) or NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...
Or, you can return control to the external controller by resetting the GPIB as follows: Return Return Control (On External Controller) This returns active control to the system controller. Note The PROGram subsystem commands in the following programs can be used on the external controller.
To Run an Instrument BASIC Program From the External Controller Figure 7-3. Sample Program : To Run the Instrument BASIC Program From the External Controller (On External Controller) You must put the disk that contains into the built-in disk drive of the analyzer before running the program.
Run the Instrument BASIC Program Line 120 runs the following program in the Instrument BASIC editor: Line 20 retrieves the program and at the same time runs the program. To Transfer the Program to Instrument BASIC Figure 7-4. Sample Program : To Transfer the Program to Instrument BASIC (on External Controller) This Program transfers the program le in the mass storage of the external controller.
Transfer the Program Transfer the program by line to the analyzer. When all program lines are transferred, the computer exits the loop and goes to line 170. Close the Instrument BASIC Editor Sending the analyzer the command closes the editor. To Load an Array in an Instrument BASIC Program to the External Controller Figure 7-5.
Programming Limit Test from Remote This chapter describes how to perform limit tests, set the limit lines, test the DUT, and transfer the results of the test. To Perform limit Test Figure 8-1. Sample Program : Limit Test (1/2) Programming Limit T est from Remote...
Lines 60 and 70 print the limit table heads on the BASIC SCREEN. Line 90 denes the table (array ) used to hold the limit values. It contains the sweep parameter, the upper limit value, and the lower limit value as follows: Segment Sweep Parameter Upper Limit...
Read the Limit Test Results command in line 450 returns the limit test result for failed points. The test results are in the following order: sweep parameter, result (0 for fail, 1 for no test), upper limit, and lower limit. command in line 470 returns the number of failed points.
Using the List Sweep Function This chapter describes how to use the list sweep function over GPIB. To Set List Sweep Figure 9-1. Sample Program : List Sweep (1/2) Using the List Sweep Function...
Figure 9-1. Sample Program : List Sweep (2/2) Edit List Table Lines 70 to 90 print the list table heads on the BASIC screen. Using the List Sweep Function...
Line 110 denes the table (array ) used to hold the list values. It contains the center frequency, frequency span, number of points, power level, and resolution band width of each segment as follows: Segment Center Frequency Number of Power Level Resolution Frequency Span Points...
8-bit I/O port without using GPIB commands. This operation is faster than using an GPIB command. For more information on these commands, see the manual. Using Instrument BASIC with the 4396B Using the Analyzer's I/O Port 10-1...
To Synchronize External Handler with Analyzer Figure 10-2. Sample Program : Synchronization of an External Handler with the Analyzer Send Signal to the External Handler command sets the 8-bit data value of the OUT 0-7 lines. The parameter command sets the OUT 3 line to TRUE (1). Figure 10-3.
Read Signal from the External Handler command returns the 4-bit data value of the IN 0-3 lines. Lines 100 to 160 wait for the external handler to set signal on line IN 3 to TRUE (1). Figure 10-5. Reading Signal from the External Handler Using the Analyzer's I/O Port 10-3...
File transfer from the 4396B to the external controller File transfer from the external controller to the 4396B Listing of the les in the current directory of the 4396B Total Harmonic Distortion Most transmitting devices and signal sources contain harmonics as shown in Figure 11-1.
This program computes the total harmonic distortion (THD) as dened by the following equation: 1 1 1 100 [%] (11 1) T H D Where, Fundamental [V] The second harmonic [V] The third harmonic [V] THD takes into account the power in all the harmonics. Because an innite number of the harmonics cannot be measured, a nite number will have to suce.
Page 75
Figure 11-2. Sample Program : Total Harmonic Distortion (THD) (2/2) In line 120 the marker searches for the fundamental frequency. In lines 200 to 340 the marker searches for the harmonics on the analyzer display and integrates the squares. Line 370 calculates the THD and line 380 prints the result. Using Application Programs 11-3...
Adjacent Channel Power Calculation The adjacent channel power measurement examines the leakage power transmitted into an adjacent channel (that is, the channel next to the carrier channel). This program calculates the adjacent channel power leakage ratio to the power of the transmitter (Pl Pc, Ph Pc) in dBc. Figure 11-3.
Page 77
Figure 11-4. Sample Program : Adjacent Channel Power Calculation (2/2) Using Application Programs 11-5...
Lines 50 to 100 set the measurement coecient, Fadj, Fs, frequency span, resolution bandwidth, number of measurement point, and averaging factor to typical values. In lines 610 to 760, the subprogram performs summation of the powers by measurement points, in the area of center frequency, , and the frequency span, .
Figure 11-6. Sample Program : Occupied Power Bandwidth Calculation (1/2) Using Application Programs 11-7...
Page 80
Figure 11-6. Sample Program : Occupied Power Bandwidth Calculation (2/2) Lines 40 to 80 set the measurement coecient, frequency span, resolution bandwidth, number of measurement points, and averaging factor to typical values. Lines 390 to 430 search from the left for the point where the power is 0.5 % compared to the total power.
GPIB commands. The storage device of the 4396B allows you to handle les listed below in the DOS format or the LIF format. For DOS format les, both binary les and ASCII les can be transferred. For LIF format les, only binary les can be transferred.
File Transfer from 4396B to External Controller This program transfers a specied le in the current directory of the 4396B to the current directory of the storage device connected to the external controller, giving a le name you desire. When executed, this program rst prompts you to enter a source le name, as shown below.
Page 83
Lines 80 to 140 accept the entry of the source le name and the destination le name. Line 160 calls the subprogram to transfer a le from the 4396B to the external controller. Lines 250 to 290 prepare for writing to the destination le.
le is greater than 16 Kbytes, the transfer routine, lines 370 to 560, is repeated until transferring all of the data is completed. Lines 620 to 720 provide a function to check that no error has occurred in the 4396B. Figure 11-8. Fixed length block format...
Page 85
Figure 11-9. Sample Program: File Transfer from External Controller to 4396B (1/2) Using Application Programs 11-13...
Page 86
le is greater than 16 Kbytes, the transfer routine, lines 390 to 590, is repeated until transferring all of the data is completed. Lines 650 to 750 provide a function to check that no error has occurred in the 4396B. Note To transfer a le from the external storage device to the 4396B, you must check the le size (number of bytes) in advance .
This program displays the list of the les in the current directory. Figure 11-10. Sample Program: Displaying List of Files in Current Directory of 4396B Line 70 calls the subprogram to display the list of the les in the current directory.
Page 88
The following is the output result of the program, assuming that the selected storage device is the memory disk and the current directory, TEST, contains 2 les, FILE1.STA (size: 24576 bytes) and FILE2.TIF (size: 16384 bytes) and 1 directory, DIR1. For size of a directory, -1 is displayed.
If Y ou Have a Problem This chapter provides the information you need to correct the listed problems. If There Is No Response From an Instrument on the GPIB Bus Check all GPIB addresses and cable connections. Most GPIB problems are caused by an incorrect address or a bad or loose GPIB cable. If an Error Message is Displayed Check the error message on the analyzer's display.
If the Disk Cannot Be Read Check the disk. 1. Put the disk into the disk drive and type as follows. 2. Press Return If error message is displayed, the disk is corrupted or the disk format does not match. Use another disk.
Check the le type. 1. Put the disk into the disk drive and type as follows: 2. Press Return If you are using Instrument BASIC Only an ASCII type program le can be saved and read. Use the SAVE/GET commands to save and read ASCII les. If you are using BASIC To read ASCII type program, use GET command.
Page 93
Manual Changes To adapt this manual to your 4396B, see Table A-1 and Table A-2, and make all the manual changes listed opposite your instrument's serial number and rmware version. Instruments manufactured after the printing of this manual may be dierent from those documented in this manual.
Page 94
Serial Number Agilent Technologies uses a two-part, nine-character serial number that is stamped on the serial number plate (see Figure A-1) attached to the rear panel. The rst four digits and the letter are the serial prex and the last ve digits are the sux.
Page 95
Change 1 The rmware revision 1.0X does not support the le transfer function. Please delete the descriptions about this function in this manual. Manual Changes...
Page 97
Index active controller, 7-1 group execution trigger, 2-4 address, 1-2, 1-4 ASCII data transfer, 4-4 , 1-6 , 2-2 averaging, 2-3 , 10-3 binary data transfer, 4-6 , 5-7 , 9-3 , 5-9 , 5-5 , 5-3 CALIBRATION COEFFICIENT ARRAYS, 4-1, , 5-5 4-5, 5-3, 5-5 , 5-5...
Page 101
Typeface Conventions Bold Boldface type is used when a term is dened. For example: icons are symbols. Italic type is used for emphasis and for titles of manuals and other Italics publications. Italic type is also used for keyboard entries when a name or a variable must be typed in place of the words in italics.
Page 102
This guide will help you learn how to eectively use Instrument BASIC (IBASIC) of the 4396B Network/Spectrum/Impedance Analyzer. It will help you to perform typical operations involving program creation, editing, and execution. It will also show you how to save and recall programs, and how to make the best use of the Instrument BASIC's front-panel and keyboard interface.
Page 103
Contents 1. Welcome to Instrument BASIC How to Use This Manual ......2. Introduction to the System Overview of Instrument BASIC .
Page 104
5. Editing Programs Getting Into/Out of the EDIT Mode ..... . Getting Into the EDIT Mode using the Front Panel Keys ... Entering the EDIT Mode from the Keyboard .
This guide will help you learn how to eectively use Instrument BASIC (IBASIC) of the 4396B Network/Spectrum/Impedance Analyzer. It will help you to perform typical operations involving program creation, editing, and execution. It will also show you how to save and recall programs, and how to make the best use of the Instrument BASIC's front-panel and keyboard interface.
Page 108
GPIB Command Reference Instrument BASIC Users Handbook This manual, , is not intended to teach Using Instrument BASIC with the 4396B Note the Instrument BASIC programming language; see the following document which is better suited to these tasks. Instrument BASIC Users Handbook...
Introduction to the System This chapter introduces the analyzer's Instrument BASIC (IBASIC) and describes how to connect and use a keyboard. Read this chapter before using Instrument BASIC with the analyzer for the rst time. The topics covered in this chapter are: Overview of Instrument BASIC Connecting the keyboard Using Instrument BASIC for the rst time...
Figure 2-1. Conguration Example of the Instrument BASIC System The Instrument BASIC's programming interface includes an editor and a set of programming utilities. The utilities allow you to perform disk I/O, renumber, secure, or delete all or part of your program. The Instrument BASIC command set is similar to the command set of HP 9000 Series 200/300 BASIC.
Using Instrument BASIC for the First Time Allocating Screen Area for Instrument BASIC Because all of the analyzer's screen is allocated for analyzer operation after power ON, you must allocate screen area for Instrument BASIC when you want to use it. The analyzer provides four display allocation types.
More information on the display allocations for the Instrument BASIC area is described in " in Appendix D. Display Setting the Size of Memory Area for Instrument BASIC The size of the memory areas for the RAM disk memory and the variable of Instrument BASIC (excluding common variables) can be changed according to your application.
Using the Keyboard What can the Keyboard be Used for? The mini-DIN keyboard can be used as follows: Performing calculations Entering arguments to the active analyzer functions Entering titles Executing commands Using softkeys The following simple operations show you how to use these functions. Performing Calculations You can perform calculations while in any display allocation type except for ALL INSTRUMENT.
4. Then press the following key on the keyboard: Enter The START value is changed to 100 kHz. 5. Next, type the following value and key: Enter After pressing the active function value is changed to 2 MHz. You can use the Enter character \ "...
Using Softkeys Pressing through on the keyboard performs the same function as pressing a softkey on the front panel. Entering BASIC Statements from the Front Panel Keys The analyzer's Instrument BASIC allows you to enter and execute statements from the front panel keys (if the external mini-DIN keyboard is not connected).
Writing and Running Programs This chapter describes how to write, execute (run), and list programs. The example program in this chapter also describes how to control the analyzer from an Instrument BASIC program. Topics covered in this chapter are: Getting into/out of the EDIT mode Writing programs Running (Executing) programs Listing programs...
Writing Programs Controlling the Analyzer Instrument BASIC can control the analyzer (itself) through the \internal" GPIB bus. This means that an analyzer with Instrument BASIC includes both a controller and an analyzer in the same instrument. They are connected through an internal GPIB bus. The select code of the internal GPIB interface is 8, and the GPIB address of the Note analyzer can be any number from 0 to 30.
Page 119
The commands are automatically entered at the current cursor position like this: 5. Press the following key: The system reads the entire line. 6. Press the following softkey: NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN The following characters are displayed on the screen: 7. Press the following key and softkey to preset the analyzer: Preset The GPIB command to preset the analyzer \ "...
Page 120
Then enter 9. Press the following keys and softkeys to set the center frequency and frequency span: NNNNNNNNNNNNNNNNNNNN NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN System Center Span 10. Then press the following keys and softkeys to execute the auto scale function: NNNNNNNNNNNNNNNNNNNN NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN System Scale Ref 11.
The screen returns to the analyzer display. Running (Executing) Programs Press the following key and softkeys from the front panel to execute the program: NNNNNNNNNNNNNNNNNNNN NNNNNNNNNNN System The system executes the program. You can execute the statement from the keyboard. Type and press as follows: Enter Listing Programs...
Listing to the Printer For hard copy output, an parallel cable must connect the analyzer to the Note printer. Let's Try 1. Set the output device to a printer as follows: Enter 2. Type and press as follows: Enter The program is listed on the printer. 3.
Saving and Getting Programs This chapter describes how to save and get programs to or from the built-in
exible disk drive and RAM disk memory. Topics of this chapter are: Saving programs (SAVE) Listing le names (CAT) Getting programs (GET) If you are using the disk drive for the rst time, see \To Save and Recall"...
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN NNNNNNNNNNNNNN le name Enter You can also save the le from the keyboard. Type and press as follows: le name Enter The program is stored on the disk. If you get the error 257, \ ", a le on the disk already has the Note name you are trying to use.
Listing to Printer For hard copy output, an parallel cable must connect the analyzer to the Note printer. 1. Set the output device to be a printer as follows: Enter 2. Press the following key among the 3 menus which leads to the key: Shift NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN NNNNNNNNNNN...
Editing Programs This chapter describes how to edit programs using the EDIT mode. The topics covered in this chapter are: Getting into/out of the EDIT mode Editing programs in the EDIT mode Renumbering program line numbers Getting Into/Out of the EDIT Mode Getting Into the EDIT Mode using the Front Panel Keys Pressing the following key and softkey allows you to enter the EDIT mode immediately, irrespective of Display Allocation.
Editing Programs in the EDIT Mode This section describes how to edit a program while in the EDIT mode, the topics are: Deleting characters Inserting characters Moving the cursor Scrolling lines and pages Jumping lines Inserting/deleting/recalling lines Clearing lines See Appendix C for more information on functions of each key. Deleting Characters There are two functions you can use to delete characters: \Back space"...
Jumping from the Current Line Jumping to a Specied Line You can specify a line by using a line number or a label name when jumping from the current line as follows: NNNNNNNNNNNNNNNNNNNNNNNNNNNNN line number Enter NNNNNNNNNNNNNNNNNNNNNNNNNNNNN label name Enter If the label specied is not dened in the program, an error will occur.
Application Programs This chapter describes Instrument BASIC programming using examples. The examples correspond to actual measurement situations. These Instrument BASIC examples will supply useful information for developing the analyzer's Instrument BASIC application programs. The topics covered in this chapter are: Controlling the analyzer using Instrument BASIC I/O operation from Instrument BASIC Using Instrument BASIC with an external controller...
For sample programs to control the analyzer, see the GPIB Programming Note Guide. I/O Operation from Instrument BASIC This paragraph describes the input/output operations using the I/O port and the storage unit. The following programs are covered in this section: Data transfer using the I/O port Reading data from the I/O port Writing data to the I/O port...
Disk I/O for a Storage Unit The analyzer has a built-in disk drive and RAM disk memory. You can save or get data using these disks with Instrument BASIC. Saving Trace Data This program saves the analyzer's current raw measurement data to an arbitrarily named le. Figure 6-4.
Using Instrument BASIC with an External Controller This program transfers a program from the Instrument BASIC memory to the external controller's disk through the GPIB interface. This program must be executed on the external controller. For other topics listed below, see Chapter 7, \Controlling Instrument BASIC Note from Remote,"...
Sharing One Printer Between Two Controllers This program shows an example of sharing one printer between two controllers. The analyzer and the external controller use the printer in sequence. The external controller uses the printer rst. The following is assumed: Two controllers and one printer on the same GPIB bus Figure 6-7 is executed on the external controller Figure 6-8 is in the Instrument BASIC editor...
Loading Instrument BASIC Programs Using Softkeys This program displays up to eight program le names in the analyzer's softkey label area. One of the programs can be selected and executed by just pressing a softkey. This feature lets you execute a program without using the keyboard. You only need to select the softkey of the program you want to execute.
Program I/O This chapter describes how to write programs that use the LCD, the I/O port, the external RUN/CONT connector in the analyzer, and the DOS le system. Topics covered in this chapter are: Graphics Using the external RUN/CONT connector File system exceptions Using the I/O port in BASIC programs Graphics...
Each point on the graphics screen is addressable using a coordinate address as shown in Figure 7-1. The bottom left corner is the origin (0,0) and the top right corner is the maximum horizontal and vertical end points (393,299). The MOVE and DRAW statement parameters are specied using these coordinate values.
Using the External RUN/CONT Connector You can use the RUN or CONT commands in a program by inputting a TTL-compatible signal to the External RUN/CONT connector on the rear panel. At the negative-going edge of a pulse more than 20 s wide (T ) in the LOW state will trigger RUN or CONT.
Using the I/O Port in BASIC Programs The Instrument BASIC can directly control the I/O port without using GPIB commands. This is faster than using the GPIB commands. Reads the 4-bit data from the I/O Port and returns a decimal value. Outputs the decimal value of the 8-bit data to the OUT 0 to 7 lines of data the I/O port.
Special Features and Advanced Techniques The topics covered in this chapter are : Autoloading and running a program automatically (AUTOST) On Key Label function Increasing program speed Autoloading and Running a Program Automatically (AUTOST) The analyzer allows you to create a special program le called AUTOST. This program is automatically loaded and run every time the analyzer is turned ON.
Increasing Program Speed Because the analyzer's CPU interleaves processing measurements and executing a program, program execution speed depends on the measurement conditions. The display process also requires processing time. To increase program speed (increase throughput), set the analyzer to the following conditions: If you do not need to measure the when executing a program, set TRIGGER MODE to HOLD.
Analyzer Specic Instrument BASIC Features This chapter lists and summarizes the Instrument BASIC features specic to the analyzer. Details of each feature are described in the previous chapters and in the appendixes. This chapter covers the following topics: Available I/O interfaces and select codes Storage units GPIB commands for Instrument BASIC Available I/O Interfaces and Select Codes...
When you want to manage the storage units using the following GPIB Note commands, use the command (for the built-in disk drive) or the command (for the RAM disk memory) to specify the storage unit. CHAD INID RESAVD SAVDGRA CRED PURG SAVDASC SAVDSTA...
GPIB Commands for Instrument BASIC The PROGram subsystem commands of the analyzer's GPIB commands are used to control Instrument BASIC. The PROGram subsystem commands do the following: Download the program from an external controller to the analyzer Upload the program from the analyzer to an external controller Delete the program on the BASIC editor of the analyzer Execute the program on the BASIC editor of the analyzer Set or query the variables and arrays in the program on the BASIC editor of the analyzer...
Manual Changes To adapt this manual to your 4396B, see Table A-1 and Table A-2, and make all the manual changes listed opposite your instrument's serial number and rmware version.
Instruments Covered by This Manual Agilent Technologies uses a two-part, nine-character serial number that is stamped on the serial number plate (see Figure A-1) attached to the rear panel. The rst four digits and the letter are the serial prex and the last ve digits are the sux.
The interface select code is 7 only. BASIC Commands Specic to 4396B The following commands are listed in the of the Instrument BASIC Language Reference , but are available in the analyzer's Instrument BASIC. Instrument BASIC Users Handbook BASIC Commands Specic to 4396B B-1...
Leading blanks or non-numeric characters are ignored. ASCII spaces are recommended as delimiters between the day, month, and year. However, any non-alphanumeric character except the negative sign ( ), may be used as the delimiter. B-2 BASIC Commands Specic to 4396B...
Page 153
The day is a blank lled to two character positions. Single ASCII spaces delimit the day, month, and year. The rst letter of the month is capitalized and the rest are lowercase charters. Years less than the year 0 are expressed as negative years. BASIC Commands Specic to 4396B B-3...
In an IF . . . THEN . . . This command executes specic GPIB commands faster than the statement. Item Description Range GPIB command string expression refer to Table B-1 Table B-1. GPIB Commands for EXECUTE B-4 BASIC Commands Specic to 4396B...
Page 155
The 4396B executes to sweep once. Execution of the next statement is suppressed until the sweep is completed. Therefore, the completion of the sweep need not be supervised using a status register. BASIC Commands Specic to 4396B B-5...
Page 156
When both an external controller and Instrument BASIC are used at the same Note time, the command occasionally does not terminate normally. If the external controller queries the instrument while the 4396B is sweeping when triggered by , the command does not terminate normally (In the worst case, a system halt occurs).
1, in register 2, and in register 3. To read a return value stored by the command, specify the appropriate register number. For more information on command, see the example in the \EXECUTE" command. BASIC Commands Specic to 4396B B-7...
0 to 86399.99 hundredth Example Commands Semantics This command changes only the time within the current day, not the date. The new clock setting is equivalent to (TIMEDATE DIV 86400) 86400 plus the specied setting. B-8 BASIC Commands Specic to 4396B...
If the computer is linked to an SRM system (and has no battery-backed clock), then the volatile clock is set to the SRM clock value when the SRM and DCOMM binaries are loaded. The clock values represent Julian time, expressed in seconds. BASIC Commands Specic to 4396B B-9...
This command returns a positive integer, in the range 0 to 86399, equivalent to the number of seconds past midnight. While any number of non-numeric characters may be used as a delimiter, a single colon is recommended. Leading blanks and non-numeric characters are ignored. B-10 BASIC Commands Specic to 4396B...
Page 161
TIME$ takes the time in seconds and returns the time of day in the form HH:MM:SS, where HH represents hours, MM represents minutes, and SS represents seconds. A module 86400 is performed on the parameter before it is formatted as a time of day. BASIC Commands Specic to 4396B B-11...
For an GPIB command that requires multiple parameters, use as many commands as the number of parameters. For more information on the command, see the \EXECUTE" command. B-12 BASIC Commands Specic to 4396B...
Character Entry Keys The character entry keys are arranged in the familiar QWERTY typewriter layout, but with additional features. Sets the unshifted keyboard to either upper-case (which is the default Caps after power ON) or lower-case (normal typewriter operation). You can enter standard upper-case and lower-case letters, using the Shift Shift key to access the alternate case.
Numeric Keypad The numerical keypad provides a convenient way to enter numbers and perform arithmetic operations. Just type in the arithmetic expression you want to evaluate, then press . The Enter result is displayed in the lower-left corner of the screen. Performs the same function as the key.
System Control Keys (Recall) recalls the last line the you entered, executed, Shift Page Up Shift Page Up (Recall) or deleted. Several previous lines can be recalled this way. Recall is particularly handy to use when you mistype a line. Instead of retyping the entire line, you can recall it, edit it using the editing keys, and enter or execute it again.
4 Shift 5 4 F9 5 Softkeys Accessed from IBASIC Menu Pressing the following: Produces the command \ " on the keyboard input line. Step executes NNNNNNNNNNNNNN a program at every line. Produces the command \ " on the keyboard input line. Resumes NNNNNNNNNNNNNNNNNNNNNNNNNN program execution from the point where it paused.
Produces the command \ ". Aborts the program. NNNNNNNNNNNNNNNNN 4 F10 5 Softkeys Accessed form key allows you to access three dierent softkey
ows dependent on conditions as follows: Pressing accesses the Program Control menu In editor mode, pressing accesses the Edit System menu Pressing accesses the On Key Label menu.
Softkeys Used for Instrument BASIC Operation The following softkeys are available with the Instrument BASIC: controls Instrument BASIC. NNNNNNNNNNNNNNNNNNNN System changes size of memory areas for Instrument BASIC and NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN the RAM disk. allocates the BASIC screen area on the display. NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN Display Softkeys Used for Instrument BASIC Operation D-1...
Page 170
System IBASIC WWWWWWWWWWWWWWWWWWWWWWWWWW Displays the following softkeys to control Instrument BASIC (IBASIC): Figure D-1. IBASIC Menu Allows you to execute one program line at a time. This is particularly NNNNNNNNNNNNNN useful for debugging. Resumes program execution from the point where it paused. NNNNNNNNNNNNNNNNNNNNNNNNNN D-2 Softkeys Used for Instrument BASIC Operation...
Page 171
Starts a program from its beginning. NNNNNNNNNNN Pauses program execution after the current program line is executed. NNNNNNNNNNNNNNNNN Stops program execution after the current line. To restart the program, NNNNNNNNNNNNNN press NNNNNNNNNNN Enters into the EDIT mode. NNNNNNNNNNNNNN Produces the command \ "...
Page 172
" Selects the character pointed to by \ ". NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN Inserts a space. NNNNNNNNNNNNNNNNN Deletes the last character entered. NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN Deletes all characters entered. NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN Terminates command entry, and executes the command you entered. NNNNNNNNNNNNNN Cancels command entry and returns to the BASIC menu. NNNNNNNNNNNNNNNNNNNN Produces the command \ ".
Page 173
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW MEMORY PARTITION Changes size of memory areas for Instrument BASIC and the RAM disk memory. Figure D-2. Memory Partition Menu Selects memory partition so that Kbyte is for RAM disk memory NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN Kbyte is for Instrument BASIC. Terminates selecting memory partition and displays the following NNNNNNNNNNNNNN softkey labels.
Page 174
Display DISPLAY ALLOCATION WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW Displays the following menu to allocate the BASIC screen area on the display. Figure D-3. Display Allocation Menu Selects a full screen single screen or two half-screen graticules. NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN Selects two half-screens, one graticule display above the Instrument NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN BASIC display.
Figure D-4. Display Allocation The following table lists the number of lines and columns in the BASIC print area for each display allocation. It also shows the keyboard input line status for each allocation. When the keyboard input line is available, you can execute BASIC commands from the keyboard. Display Allocation BASIC Print Area Keyboard Input Line Columns Lines...
Page 178
inserting, 5-3 writing, 3-2 jumping, 5-3 program speed recalling, 5-3 increasing, 8-2 renumber, 5-3 scrolling, 5-2 list, 3-5 RAM disk memory, 9-2 on the screen, 3-5 , 7-4, B-7 to printer, 3-6 RUN/CONT connector, 7-3 trigger signal, 7-3 run light indication, D-7 manual changes, A-1 MASS STORAGE IS, 7-3 \MEMORY,0", 7-3...
Page 179
REGIONAL SALES AND SUPPORT OFFICES For more information about Agilent Technologies test and measurement products, applications, services, and for a current sales office listing, visit our web site: http://www.agilent.com/find/tmdir. You can also contact one of the following centers and ask for a test and measurement sales representative.