Home

Programming Guide - Steven M. Anlage Research Page

image

Contents

1. 10000 160 Chapter 4 Downloading and Using Files Downloading ARB Waveform Data The following additional Matlab M file programming examples are available on the PSG Documentation CD ROM barker m This programming example calculates and downloads an arbitrary waveform file that simulates a simple 7 bit barker RADAR signal to the PSG vector signal generator chirp m This programming example calculates and downloads an arbitrary waveform file that simulates a simple compressed pulse RADAR signal using linear FM chirp to the PSG vector signal generator FM m This programming example calculates and downloads an arbitrary waveform file that simulates a single tone FM signal with a rate of 6 KHz deviation of 14 3 KH Bessel null of dev rate 2 404 to the PSG vector signal generator nchirp m This programming example calculates and downloads an arbitrary waveform file that simulates a simple compressed pulse RADAR signal using non linear FM chirp to the PSG vector signal generator pulse m This programming example calculates and downloads an arbitrary waveform file that simulates a simple pulse signal to the PSG vector signal generator pulsedroop m This programming example calculates and downloads an arbitrary waveform file that simulates a simple pulse signal with pulse droop to the PSG vector signal generator Downloading Waveforms from M atlab This procedure describes how to download a waveform
2. Purpose To calculate and download an arbitrary waveform file that simulates a simple antenna scan pulse pattern to the PSG vector signal generator Define Variables n counting variable no units t time seconds rise raised cosine pulse rise time definition samples on pulse on time definition samples fall raised cosine pulse fall time definition samples i in phase modulation signal q quadrature modulation signal n 4 defines the number of points in the rise time and fall time t 1 2 n 1 2 n number of points translated to time rise 1 sin t pi 2 2 90 defines the pulse rise time shape on ones 1 120 defines the pulse on time characteristics fall 1 sin t pi 2 2 defines the pulse fall time shape off zeros 1 896 defines the pulse off time characteristics arrange the i samples and scale the amplitude to simulate an antenna scan pattern comprised of 10 pulses i 707 rise on fall off 9 rise on fall off 158 Chapter 4 Downloading and Using Files Downloading ARB Waveform Data 8 rise on fall off 7 rise on fall off 6 rise on fall off 5 rise on fall off A rise on fall off 3 rise on fall off 2 rise on fall off 1 rise on fall off set the q samples to all zeroes q zeros 1 10240 define a composite iq matrix for download to the PSG
3. 165 Downloading and Using Files Downloading ARB Waveform Data delete buf else fprintf stderr Could not allocate memory for copy buffer n fclose file iclose id return 0 Downloading Using HP BASIC for Windows The following program uses HP BASIC for Windows to download a waveform into WFM1 The waveform generated by this program is the same as the default SINE TEST WFM waveform file available in the signal generator s waveform memory This code is similar to the code shown Downloading Using HP BASIC for UNIX on page 168 but there is a formatting difference in line 130 and line 140 To download into NVWFM replace line 190 with 190 OUTPUT Psg USING K MMEM DATA NVWFM testfile As discussed at the beginning of this section I and Q waveform data is interleaved into one file in 2 s compliment form and a marker file is associated with this I Q waveform file In the Output commands USING 4 K formats the data The pound symbol suppresses the automatic end of line EOL output This allows multiple output commands to be concatenated as if they were a single output The K instructs HP BASIC to output the following numbers or strings in the default format 10 RE SAVE BASIC Win file 20 Num points 200 30 ALLOCATE INTEGER Int array 1 Num points 2 40 DEG 50 FOR I 1 TO Num points 2 STEP 2 60 Int array 1 INT 32767 SIN I 360 Num points 70 NEXT I 8
4. STAT QUES MOD COND n set bits viScanf vi TOU V3 nd Ss rdBuffer set bits num int rdBu switch num case 1 printf Signal Printe n 4 break case 2 printf Signal p intE kn break case 4 printf Signal pDrintE Xn break case 8 printf Signal orintE ka s break case 16 print Signal p intE kn break default ffer 1 0 Generator Generator Generator Generator Generator printf No Problems with Chapter 2 Modulation Modulation Modulation Modulation Modulation Programming Examples GPIB Programming Examples Modulation Condition Register 14 Querys the register for any Reads the decimal sum of the Converts string data to numeric Based on the decimal value 1 Undermod Win 1 Overmod n 2 Undermod n 2 Overmod Win Uncalibrated n Modulationin 59 Programming Examples GPIB Programming Examples printf nyy Close the sessions viClose vi viClose defaultRM Reading the Service Request Interrupt SRQ Using VISA and C This example demonstrates use of the Service Request SRQ interrupt By using the SRQ the computer can attend to other tasks while the signal generator is busy performing a function or operation When the signal generator finishes it s operation or detects a failure then a Service Request can be generated T
5. marker value guerys are treated as commands x Example SENS FREQ CENT CALC1 MARK1 X x7 BRR KK RK KR KK KKK RR EE k kok RR EE RR EE RE KK RR EE KK KK e if query strchr cmd NULL Make sure we don t have a marker value query or 90 Programming Examples LAN Programming Examples any command with a followed by a character This kind of command is not a query from our point of view The signal generator does the query internally and uses the result a querytt bump past while query if query attempt to ignore white spc querytt else break return q RRR RR RR RR KK KK Ck Ck kk Ck IKK RR EE RR EE RE RR RE KR IRR Kk kk Kk oko k k ke RX RA RX EE XX ke gt Function main SDescription Read command line arguments and talk to signal generator Send query results to stdout SReturn int non zero if an error occurs kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk k kk kk kok k A ke ke int main int argc char argv Chapter 2 91 Programming Examples LAN Programming Examples SOCKET instSock 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 0 basename strrchr argv 0 if basename NULL basenamet else basename argv 0
6. The Agilent SICL function converts data using the format string The format string specifies how the argument is converted before it is output The function sends the characters in the format string directly to the instrument The parameter list includes the instrument address data buffer to write and so forth The Agilent BASIC function ENTER reads formatted data from the signal generator Other IO libraries use similar functions to read data from the signal generator Agilent BASIC VISA NI 488 2 Agilent SICL 10 ENTER 719 viScanf parameter list ibrd parameter list iscanf parameter list Agilent BASIC The function ENTER 719 puts the signal generator into remote mode makes it a talker and assigns data or status information to a designated variable VISA Library The VISA library uses the viScanf function and an associated parameter list to receive data This function receives data from the instrument formats it using the format string and stores the data in the argument list The parameter list includes the session id and string argument NI 488 2 Library The NI 488 2 library function addresses the GPIB reads data bytes from the signal Chapter 1 11 Getting Started Using LAN generator and stores the data into a specified buffer The parameter list includes the instrument address and session id SICL The Agilent SICL function reads formatted data converts it and stores the
7. printf n Prints new line character to the display viClose vi Closes session viClose defaultRM Closes default session Queries Using Agilent BASIC This example program demonstrates signal generator query commands over RS 232 Query commands are of the type IDN and are identified by the question mark that follows the mnemonic Start Agilent BASIC type in the following commands and then RUN the program The following program example is available on the PSG Documentation CD ROM as rs232ex2 txt 10 VK CK KK Ck Kk K A K A Ck AZ A KA Ck Ck SK A KA KA Ck CK A KA KA kk A KA kk KA A KA KA AKA AXA KA ck kck ck kck ck ck ck ck k kck ck ckck ck kc kck ck ck ck ckck ok 20 30 PROGRAM NAME rs232ex2 txt 40 50 PROGRAM DESCRIPTION In this example query commands are used to read 60 1 data from the signal generator Chapter 2 109 Programming Examples RS 232 Programming Examples 70 80 Start Agilent BASIC type in the following code and then RUN the program 90 i 00 1K RK RK Ck Kk K A RE A KA KA Ck CK A KA KA KA A KA KA kk A KA KA kk KK AKA AXA KK AKA AX KK ck kc kck kckck OK kck ck k RX ok 10 20 INTEGER Num 30 DIM Str 200 Str1 20 40 CONTROL 9 0 1 Resets the RS 232 interface 50 CONTROL 9 3 9600 Sets the baud rate to match signal generator rate 60 STATUS 9 4 Stat Reads the value of register 4 70 Num BINAND Stat 7 Gets the AND value 80 CONTROL 9 4 Num Sets the parity to
8. 230 240 250 320 330 340 350 Programming Examples GPIB Programming Examples PROGRAM DESCRIPTION In REMOTE mode access to the signal generators l functional front panel keys are disabled except for the Local and Contrast keys The LOCAL LOCKOUT command will disable the Local key The LOCAL command executed from the controller is then the only way to return the signal generator to front panel Local control Vo ck ck ck kk koc Ck kk ck Ck ck kk Ck kk kk kk kk ck kk ko kk kk ko kk kk ko kk X ko kk RE ko ko Sk ko ko ko ko ko ko RR ko k ko k ko ko ko k ko ko ko Sig gen 719 Declares a variable to hold signal generator address CLEAR Sig gen Resets signal generator parser and clears any output LOCAL Sig gen Places the signal generator in local mode REMOTE Sig gen Places the signal generator in remote mode CLEAR SCREEN Clears the controllers display OUTPUT Sig gen RST Places the signal generator in a defined state The following print statements are user prompts PRINT The signal generator should now be in remote PRINT Verify that the R and L annunciators are visable PRINT Tere Press Continue PAUSE LOCAL LOCKOUT 7 Puts the signal generator in LOCAL LOCKOUT mode PRINT Prints user prompt messages PRINT Signal generator should now be in LOCAL LOCKOUT mode PRINT Verify that all keys including Local except Contrast keys have no effect PRINT PRINT
9. Clears the signal generator viPrintf vi RST n Resets the signal generator viPrintf vi FM2 INT FREQ 5 kHz n Sets EXT 2 source for FM viPrintf vi FM2 DEV 100 kHz Nn Sets FM path 2 coupling to AC viPrintf vi FREQ 900 MHz n Sets carrier frequency to 700 MHz viPrintf vi POW 15 dBm n Sets the power level to 2 3 dBm viPrintf vi FM2 STAT ON n Turns on frequency modulation viPrintf vi OUTP STAT ON n Turns on RF output printfi Xu s Prints a carriage return Print user information printf Power level 15 dBm n printf FM state on n printf RF output on n printf Carrier Frequency 900 MHZ n printf Deviation 100 kHZ n printf Internal modulation 5 kHz n printf n Print a carrage return Close the sessions viClose vi viClose defaultRM 50 Chapter 2 Programming Examples GPIB Programming Examples Generating a Step Swept Signal Using VISA and C In this example the VISA library is used to set the signal generator for a continuous step sweep on a defined set of points from 500 MHz to 800 MHz The number of steps is set for 10 and the dwell time at each step is set to 500 ms The signal generator will then be set to local mode which allows the user to make adjustments from the front panel Launch Microsoft Visual C 6 0 add the required files and enter the following code into your cpp source file The following program example
10. Put your hostname here if instSock INVALID_SOCKET fprintf stderr Unable to open socket n return 1 fprintf stderr Socket opened n bufBytes queryInstrument instSock IDN n charBuf INPUT BUF SIZE printf ID s n charBuf commandInstrument instSock FREQ 2 5 GHz n printfi Xmn bufBytes queryInstrument instSock FREQ CW n charBuf INPUT BUF SIZE printf Frequency s n charBuf commandInstrument instSock POW AMPL 5 dBm n bufBytes queryInstrument instSock POW AMPL n charBuf INPUT BUF SIZE printf Power Level s n charBuf printfi Xm ifdef WINSOCK closesocket instSock 98 Chapter 2 Programming Examples LAN Programming Examples close winsock else close instSock endif WINSOCK return 0 ROR KKK KKK KKK I KK IKK IKK RR KR IKK KK I RR EE RR KK IR k k k k k k k k k oko kok k A HK getopt 3C getopt 3C PROGRAM FILE NAME getopt c getopt get option letter from argument vector SYNOPSIS int getopt int argc char const argv const char optstring extern char optarg extern int optind opterr optopt PRORGAM DESCRIPTION getopt returns the next option letter in argv starting from argv 1 that matches a letter in optstring optstring is a string of recognized option letters if a letter is followed by a colon the option is expected to have an argument that may or may not be separated fro
11. OPC E O 90 El z O UTPUT 717 SYST LANG COMP 1 100 WAIT 5 110 OUTPUT 716 C2 120 END Chapter 2 67 Programming Examples LAN Programming Examples LAN Programming Examples e VXI 11 Programming Using SICL in C on page 68 e VXI 11 Programming Using VISA in C on page 71 e Setting Parameters and Sending Queries Using Sockets and C on page 75 e Setting the Power Level and Sending Queries Using PERL on page 102 Generating a CW Signal Using Java on page 103 The LAN programming examples in this section demonstrate the use of VXI 11 and Sockets LAN to control the signal generator For details on using FTP and TELNET refer to Using FTP on page 20 and Using TELNET LAN on page 17 of this guide Before Using the Examples To use these programming examples you must change references to the IP address and hostname to match the IP address and hostname of your signal generator VXI 11 Programing The signal generator supports the VXI 11 standard for instrument communication over the LAN interface Agilent IO Libraries support the VXI 11 standard and must be installed on your computer before using the VXI 11 protocol Refer to Using VXI 11 on page 16 of this Programming Guide for information on configuring and using the VXI 11 protocol The VXI 11 examples use TCPIPO as the board address VXI 11 Programming Using SICL in C The following program uses the VXI 11 protocol and SICL t
12. Open session to GPIB device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI NULL VI NULL amp vi if viStatus If problems then prompt user printf Could not open ViSession Nn printf Check instruments and connections M n print l tiat exit 0 viPrintf vi RST n Resets signal generator viPrintf vi FREQ CW n Querys the CU frequency viScanf vi t rdBuffer Reads response into rdBuffer Prints the source frequency printf Source CW frequency is s n rdBuffer printf Press any key to continue n print tiat Prints new line character to the display getch viPrintf vi POW AMPL n Querys the power level viScanf vi t rdBuffer Reads the response into rdBuffer Prints the source power level printf Source power dBm is s n rdBuffer printf Press any key to continue n print t mts Prints new line character to the display getch viPrintf vi FREQ MODE Nn Querys the frequency mode viScanf vi t rdBuffer Reads the response into rdBuffer Prints the source freq mode printf Source frequency mode is s n rdBuffer printf Press any key to continue n printer n Prints new line character to the display getch Chapter 2 43 Programming Examples GPIB Programming Examples viPrintf vi OUTP OFF n Turns source RF state off wiPrinti vi OUTP TYAn Querys the signal gen
13. include lt visa h gt include lt iostream gt include lt stdlib h gt include lt conio h gt void main ViSession defaultRM vi Declares variables of type ViSession for instrument communication ViStatus viStatus 0 Declares a variable of type ViStatus for GPIB verifications char rdBuffer 256 Declare variable to hold string data int num Declare variable to hold integer data viStatus viOpenDefaultRM amp defaultRM Initialize VISA system Open session to GPIB device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI NULL VI NULL amp vi if viStatus If problems then prompt user printf Could not open ViSession Mn printf Check instruments and connections n printf n yy exit 0 viPrintf vi RSTXn Reset the signal generator viPrintf vi FREQ 500 kHz n Set the source CW frequency for 500 kHz viPrintf vi FREQ CW n Query the CW frequency viScanf vi t rdBuffer Read signal generator response printf Source CW frequency is s n rdBuffer Print the frequency viPrintf vi POW AMPL 2 3 dBm n Set the power level to 2 3 dBm viPrintf vi POW AMPL n Query the power level viScanf vi t rdBuffer Read the response into rdBuffer printf Source power dBm is s n rdBuffer Print the power level Chapter 2 45 Programming Examples GPIB Programming Examples viPrintf vi OUTP STAT
14. lt blockdata gt MMEM DATA SWFM1 filename lt blockdata gt MMEM DATA filename SWFMI SCPI non volatile memory MMEM DATA user securewave filename lt blockdata gt MMEM DATA SNVWFM filename lt blockdata gt MMEM DATA filename SNVWFM FTP volatile memory put filename user bbg1 securewave newfilename FTP non volatile memory put filename user securewave newfilename Chapter 4 173 Downloading and Using Files Downloading User File Data Downloading User File Data The signal generator accepts user file data downloads The files can be in either binary or bit format each consisting of 8 bit bytes Both file types are stored in the signal generator s non volatile memory e In binary format the data is in multiples of 8 bits all 8 bits of a byte are taken as data and used In bit format the number of bits in the file is known and the non data bits in the last byte are discarded After downloading the files they can be selected as the transmitting data source This section contains information on transferring user file data from a PC to the signal generator It explains how to download user files into the signal generator s memory and modulate the carrier signal with those files When a file is selected for use in Real time Custom mode the file is modulated as a continuous unframed stream of data according to the modulation type symbol rate and filtering associated with the selected format
15. 0c cece cee eee 170 Troubleshooting ARB Waveform Data Download Problems 171 Understanding ARB Waveform File Composition and Encryption 172 Downloading waveform data to the PSG for extraction as an encrypted waveform file 172 Extracting waveform files from the PSG for use in other PSGS Bo Downloading encrypted waveform files to the PSG 2 139 Downloading User Pile Dala ies seiesiions gue ER X orbe HER her ROUEN Ee ERE TEER qd 174 Data Requirements and Limitations i4 s4 460s44054 64255 40554 R445 ERR PRORA RR EP de 175 Band Dinary irene ces oed dote dade d eR Od uet edibebd deo ipe vd dq 176 Selecting Downloaded User Files as the Transmitted Data 178 Troubleshooting User File Download Problems 5iucesieco kt hh RR RE dd deda ERES 178 Downloading FIR Filter oefficletite 42204614544 ie e Roe a P RR RERO E WE RR o RR de 179 Data Requirements and Limitations i Loue cc obe XR GRE ROBUR ORE debe RR RT UAR EP XR 179 Downloading FIR Filter CoetEetenis La iaia R per SR eis PERE RAE SHIRE DEORE d 180 Selecting a Downloaded User FIR Filter as the Active Filter 181 Troubleshooting FIR Filter Coefficient File Download Problems 181 Downloading Directly into Pattern RAM PRAM issues RR RR Ree RR ERR 182 Preliminary Sup Les na mea
16. 1 wVersionRequested MAKEWORD 2 0 err WSAStartup wVersionRequested amp wsaData Chapter 2 79 Programming Examples LAN Programming Examples Tell the user that we couldn t find a useable winsock dll fprintf stderr Cannot initialize Winsock 1 1 n return 1 return 0 int close winsock void WSACleanup return 0 endif WINSOCK o e F kok ok RE RR RR RE RR EE RR EE RE KK IK EE RE RR EE RE RE RR EE RR RE RR k kok RX ERROR XX ke ke Function openSocket SDescription open a TCP IP socket connection to the instrument Parameters ui const char hostname Network name of instrument This can be in dotted decimal notation i int portNumber The TCP IP port to talk to Use 7777 for the SCPI port SReturn int A file descriptor similar to open 1 SErrors returns 1 if anything goes wrong 80 Chapter 2 Programming Examples LAN Programming Examples FR RR kok k AR IRR IA AR IRR IR AR IRR k k k kok k k k kok k kk k kk kk kk k kk k k kk SOCKET openSocket const char hostname struct hostent hostPtr struct sockaddr_in peeraddr_in SOCKET s memset amp peeraddr_in 0 int portNumber sizeof struct sockaddr in RRR KK KK KK KK IKK IK kok oko k kok k k IR ko ke ke ke ke ke ee e map the desired host name to internal form xy RRR KR RR KR KK IKK KR
17. Query STATus QUEStionable FREQuency EVENt Data Questionable Frequency Event Enable Register Lets you choose which bits in the Data Questionable Frequency Event Register set the summary bit bit 5 of the Data Questionable Condition Register to 1 Command STATus QUEStionable FREQuency ENABle value where value is the sum of the decimal values of the bits you want to enable Example Enable bit 9 and bit 3 so that whenever either of those bits is set to 1 the Data Questionable Frequency summary bit of the Data Questionable Condition Register is set to 1 send the command STAT QUES FREQ ENAB 520 512 8 Query STATus QUEStionable FREQuency ENABle Response Decimal value of the sum of the bits previously enabled with the STATus QUEStionable FREQuency ENABle value command Chapter 3 143 Programming the Status Register System Status Groups Data Questionable M odulation Status Group The Data Questionable Modulation Status Group is used to determine the specific event that set bit 7 in the Data Questionable Condition Register This group consists of the Data Questionable Modulation Condition Register the Data Questionable Modulation Transition Filters negative and positive the Data Questionable Modulation Event Register and the Data Questionable Modulation Event Enable Register Modulation 1 Undermod Modulation 1 Overmod Modulation 2 Undermod Modulation 2 Overm
18. SCPI error queue 25 SCPI register model 114 service request method status registers 119 service request method using 119 SetRWLS 9 SICL 6 12 22 30 iabort 8 iclear 10 igpibllo 9 iprintf 11 iremote 9 iscanf 12 signal generator monitoring status 114 sockets example 73 75 Java 103 LAN 68 73 PERL 101 UNIX 73 Windows 74 sockets LAN 17 SRE commands 121 SRQ command 119 SRQ method status registers 119 standard event status enable register 128 status group 127 status register 128 standard operation condition register 130 133 event enable register 131 134 event register 131 133 status group 129 132 transition filters 130 133 status byte group 123 overall register system 115 116 register 124 status groups data questionable 135 data questionable calibration 147 data questionable frequency 141 data questionable modulation 144 data questionable power 138 registers 126 standard event 127 190 Index standard operation 129 132 status byte 123 status registers See also registers accessing information 118 bit values 117 hierarchy 114 how and what to monitor 118 in status groups 126 overall system 115 116 programming 113 SCPI commands 121 SCPI model 114 setting and querying 121 standard event 128 standard event status enable 128 system overview 114 using 117 STB command 121 system requirements C C examples 28 T talker 7 TCP I
19. VI NULL amp vi Chapter 2 53 Programming Examples GPIB Programming Examples if viStatus If problems then prompt user printf Could not open ViSession n printf Check instruments and connections Mn printer Wn exit 0 printf nt y viClear vi Clears the signal generator viPrintf vi CLSXn Resets the status byte register Print user information printf Programming example using the SAV RCL SCPI commands Mn printf used to save and recall an instrument s state n printE l tint s viPrint vi RSTXn Resets the signal generator viPrintf vi FREQ 5 MHz n Sets sig gen frequency viPrintf vi POW ALC OFF n Turns ALC Off viPrintf vi POW AMPL 3 2 dBm n Sets power for 3 2 dBm viPrintf vi OUTP STAT ON n Turns RF output On viPrintf vi OPC n Checks for operation complete while lngDone viScanf vi d amp lngDone Waits for setup to complete viPrintf vi SAV lat Saves sig gen state to register 41 Print user information printf The current signal generator operating state will be savedin printf to Register 1 Observe the state then press Enter n printf Nn Prints new line character getch Wait for user input lngDone 0 Resets the operation complete flag viPrintf vi RSTX n Resets the signal generator viPrintf vi OPC n Checks for operation complete while lngDone viSc
20. When a user file is selected as the data source the signal generator s firmware loads the data into waveform memory and sets the other control bits depending on the operating mode regardless of whether framed or unframed transmission is selected In this manner user files are mapped into waveform memory bit by bit one bit per 32 bit control word NOTE Unlike pattern RAM PRAM downloads see page 182 user files contain data field information only The control data bits required for files downloaded directly into PRAM are not required for user file data NOTE References to pattern RAM PRAM are for descriptive purposes only relating to the manner in which the memory is being used PRAM and volatile waveform memory WFM1 actually utilize the same storage media 174 Chapter 4 Downloading and Using Files Downloading User File Data Data Requirements and Limitations 1 Data must be in binary format SCPI specifies the data in 8 bit bytes NOTE Not all binary values are ASCII characters that can be printed In fact only ASCII characters corresponding to decimal values 32 through 126 are printable keyboard characters Typically the ASCII character corresponding to an 8 bit pattern is not printable Because of this the program written to download and upload user files must correctly convert the binary data into 8 bit ASCII characters 2 For binary downloads bit length must be a multiple of 8 SCPI specifies data in 8 bit
21. anaes emma Press Continue PAUSE PRINT LOCAL 7 Returns signal generator to Local control The following print statements are user prompts PRINT Signal generator should now be in Local mode Chapter 2 35 Programming Examples GPIB Programming Examples 360 PRINT 370 PRINT Verify that the signal generator s front panel keyboard is functional 380 PRINT 390 PRINT To re start this program press RUN 400 END Local Lockout Using NI 488 2 and C This example uses the NI 488 2 library to set the signal generator local lockout mode Launch Microsoft Visual C 6 0 add the required files and enter the following code into your cpp source file This example is available on the PSG Documentation CD ROM as niex2 cpp ck ck ck kk kk HA A A A AX X AX X X X X AX X AX ck AX X AX RR X AX ck ck X ck ck ck ck X ck ck ck ck ck X RR X ck ck ck ck ck ck ck ck ck ck ck RR ck ck ck ck ck ck ck Ck Ck Ck Ck Ck ck ck ck ck ck ck ck kc ko PROGRAM NAME niex2 cpp PROGRAM DESCRIPTION This program will place the signal generator into LOCAL LOCKOUT mode All front panel keys except the Contrast key will be disabled The local command ibloc sig executed via program code is the only way to return the signal generator to front panel Local control ck ck ck ck kk kk e ee A X AX X ce X X X X X XX AX X AX X X AX X AX ck ck ck ck ck ck ck ck X ck X ck ck X ck ck ck X ck ck ck ck ck ck ck ck ck RR RR RR ck ck
22. from ARB memory No RF Output If no user marker file is provided a default marker file containing all zeros is created If the signal generator s Mrk 2 to RF Blank softkey is set to on the RF is blanked Go to MODE gt Dual ARB gt ARB Setup and toggle Mrk 2 to RF off NOTE Review Data Requirements and Limitations on page 154 Chapter 4 171 Downloading and Using Files Understanding ARB Waveform File Composition and Encryption Understanding ARB Waveform File Composition and Encryption When you generate a waveform from an ARB personality option including Signal Studio a waveform file is automatically created and stored in volatile memory along with providing you the option of renaming and or moving it to non volatile memory for safe storage The waveform file is comprised of header information waveform data and marker data The header information contains PSG ARB settings so that if the header is saved the waveform can be identically reproduced The ARB settings default to unspecified unless you save the header information In either case header information always accompanies the waveform data Additionally these waveform files can be extracted from the PSG in encrypted form for use in other PSGs having the same option You can also extract encrypted files created with applications such as MATLAB providing the data was downloaded to the PSG using the method described in the section below Files cannot be e
23. ibrd sig rdVal 100 Enters in the source frequency mode rdVal ibcntl 0 Null character indicating end of array cout lt lt Source frequency mode is lt lt rdVal Print source frequency mode cout lt lt Press any key to continue endl cin ignore 10000 Xn ibwrt sig OUTP OFF 12 Turns off RF source ibwrt sig OUTP 5 Querys the on off state of the instrument ibrd sig rdVal 2 Enter in the source state rdVal ibcntl 0 num int rdval 0 0 if num gt O cout lt lt Source RF state is On lt lt endl telsel cout lt lt Source RF state is Off endl cout lt lt endl ibwrt sig IDN 5 Querys the instrument ID ibrd sig rdVal 100 Reads the source ID rdVal ibcntl 0 Null character indicating end of array cout lt lt Source ID is rdVal Prints the source ID cout Press any key to continue endl cin ignore 10000 n ibwrt sig SYST COMM GPIB ADDR 20 Querys source address ibrd sig rdVal 100 Reads the source address rdVal ibcntl 0 Null character indicates end of array Prints the signal generator address cout lt lt Source GPIB address is lt lt rdVal cout lt lt endl cout lt lt Press the Local key to return the signal generator to LOCAL control lt lt endl Chapter 2 41 Programming Examples GPIB Programming Examples cout lt lt endl return 0 Queries U
24. include stdafx h include lt iostream gt include windows h include Decl 32 h using namespace std int GPIBO oy Board handle Addr4882 t Address 31 Declare a variable of type Addr4882 t int main 40 int sig Declares variable to hold interface descriptor int num char rdVal 100 Declares variable to read instrument responses sig ibdev 0 19 0 13 1 0 Open and initialize a device descriptor ibloc sig Places the signal generator in local mode ibclr sig Sends Selected Device Clear SDC message ibwrt sig RST 4 Places signal generator in a defined state ibwrt sig FREQuency CW 14 Querys the CW frequency ibrd sig rdVal 100 Reads in the response into rdVal rdVal ibcntl 0 Null character indicating end of array cout lt lt Source CW frequency is rdVal Print frequency of signal generator cout lt lt Press any key to continue endl cin ignore 10000 Xn ibwrt sig POW AMPL 10 Querys the signal generator ibrd sig rdVal 100 Reads the signal generator power level rdVal ibcntl 0 Null character indicating end of array Prints signal generator power level Chapter 2 Programming Examples GPIB Programming Examples cout lt lt Source power dBm is lt lt rdVal cout lt lt Press any key to continue lt lt endl cin ignore 10000 Xn ibwrt sig FREO MODE 11 Querys source frequency mode
25. lt 240 bytes of data gt the binary waveform data order for each 2 byte sample is defined as MSB most significant byte first and LSB least significant byte last The waveform must have at least 60 samples of data Each sample I Q data is represented by 4 bytes 2 bytes for the I sample and 2 bytes for the Q sample In this example 240 bytes of data represents 60 samples of data Chapter 4 155 Downloading and Using Files Downloading ARB Waveform Data Example 2 MMEM DATA WFM1 file_name 212125407897ABC file_name the file name to appear in the signal generator s waveform memory catalog 2 2 decimal digits will be used to define the number of data bytes 12 12 bytes of data will follow 125407897ABC the ASCII representation of the data downloaded to the signal generator NOTE This example has too few samples to be used and is shown only to illustrate the form Typically you cannot read type the sample values as they are frequently unprintable Downloads to WFM1 NOTE Before downloading files into waveform memory turn off the ARB Mode gt Dual ARB gt ARB Off On or send SOURce RADio ARB STATe OFF waveform file MMEM DATA WFM1 lt file name gt ABC markers file MMEM DATA MKR1 lt file name gt ABC The full directory path name can be specified in the command line The following SCPI commands are equivalent to the previous commands waveform file MMEM DATA USER B
26. printing printf Xn Print user information printf An SRO indicating end of sweep has occurred n viClose event Closes the event return VI SUCCESS 64 Chapter 2 Programming Examples GPIB Programming Examples Using 8757D Pass Thru Commands Pass thru commands enable you to temporarily interrupt ramp sweep system interaction so that you can send operating instructions to the PSG This section provides setup information and an example program for using pass thru commands in a ramp sweep system Equipment Setup To send pass thru commands set up the equipment as shown in Figure 2 1 Notice that the GPIB cable from the computer is connected to the GPIB interface bus of the 8757D Figure 2 1 COMPUTER BNC Cable BNC Cable BNC Cable GPIB Cable i 8757 Blank Mkrs t System Interface SIGNAL SCALAR GENERATOR grada NETWORK ANALYZER scaler_netwk_pc Chapter 2 65 Programming Examples GPIB Programming Examples GPIB Address Assignments Table 2 1 describes how GPIB addresses should be assigned for sending pass thru commands These are the same addresses used in Example 2 1 Table 2 1 Instrument GPIB Key Presses Description Address PSG 19 Press Utility gt GPIB RS 232 LAN gt GPIB Address gt 19 gt Enter 8757D 16 Press LOCAL gt 8757 gt 16 gt Enter 8757D 19 This address must match the PSG Sweeper Press LOCAL gt SWEEPER gt 19 gt En
27. Data Questionable Status Group 3 To Data Questionable Status Group 5 To Data Questionable Status Group 7 To Data Questionable Status Group 8 To Data Questionable Status Group 12 To Standard Operation Status Group 10 Data Quest BERT Status Group Option UN7 amp 300 only No Clock No Data Change PRBS Sync Loss Unused Unused Unused Unused Unused Unused Unused Unused Downconv Demod Out of Lock Demod DSP Ampl Out of Range Sync to BCH TCH PDCH Waiting for TCH PDCH Always Zero 0 Trans Filter Trans Filter Event Register Event Enable Reg Baseband 1 Busy Baseband 1 Communicating Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Always Zero 0 Event Register vent Enable Reg statreg_lof2 115 Programming the Status Register System Overview Figure 3 2 The Overall Status Byte Register System 2 of 2 Status Byte Register From Data Questionable Power Status Group From Data Quest Frequency Status Group Data Questionable Status Group From Data Quest Modulation Status Group Unused Reg Serv Su m Bit ROS 6 tot Unused Std Operation Status Sum Bit From Data Quest Calibration Status Group Unused summary From Data Quest BERT Status Group TEMPerature On Ou K On Oo T ven 8 lllxeeess summary EAE Unused i
28. ERU ELE NEN E Pees SEO dc dd exe guer sea 182 Data Requirenients atid Limitations 5 s6ka 45b 6ks k HR YER REOR de ods d dus 183 Downloads I List PORA aa ee Dec Rb E RR eRe CEP RG eels QC PCR RES A dE d pa 184 Dornloading ot Block Format 22 aiii p eed quee d eet pice eric ii d derbi died es 185 Modulating and Activating the C america reno ERXeURRRRLERATEREERERE RR AU RE RR ARE RS 186 Mies 8 PRAM WARIO 445 osa od eR ondra ceed eee che eae dibeq ab dido 186 Troubleshooting Direct PRAM Download Problems lt 186 Contents vi 1 Getting Started This chapter provides the following major sections Introduction to Remote Operation on page 2 Using GPIB on page 4 Using LAN on page 12 Using RS 232 on page 22 Error Messages on page 25 Getting Started Introduction to Remote Operation Introduction to Remote Operation PSG signal generators support the following interfaces e General Purpose Interface Bus GPIB Local Area Network LAN e ANSI EIA232 RS 232 serial connection Each of these interfaces in combination with an IO library and programming language can be used to remotely control the signal generator Figure 1 1 uses the GPIB as an example of the relationships between the interface IO libraries programming language and signal generator Figure 1 1 Software Hardware Layers Programming Language C C Visual BASIC LabView etc National Instruments
29. KK KK OK RK KK KK hostPtr gethostbyname hostname if hostPtr NULL fprintf stderr unable to resolve hostname return INVALID SOCKET ROR RK ke ke e eee e e ee e e create a socket RRR ke k ke e ee ke e e ee e e S socket AF INET SOCK STREAM if s INVALID SOCKET fprintf stderr unable to create socket to s hostname return INVALID SOCKET Chapter 2 0 s in hostname s n strerror errno 81 Programming Examples LAN Programming Examples memcpy epeeraddr in sin addr s addr hostPtr gt h addr hostPtr gt h length peeraddr_in sin_family AF_INET peeraddr in sin port htons unsigned short portNumber if connect s const struct sockaddr amp peeraddr in sizeof struct sockaddr in SOCKET ERROR fprintf stderr unable to create socket to s Ss n hostname strerror errno return INVALID SOCKET return s RRR KK kk RR RE RR EE RR EE RE RR EE RE Kk Ck IKK Kk RE Kk KC Kk Ck Kk k KC RE RR k kok RX RX ke kk ke ke gt Function commandInstrument Description send a SCPI command to the instrument Parameters hi FILE file pointer associated with TCP IP socket const char command SCPI command string Return char a pointer to the result string SErrors returns 0 if send fails FRR RR Ck Ck Ck KK k kok k k kok k XX Kk kok k k o
30. ON n Turn source RF state on wiPrinti vi OUTP TYAn Query the signal generator s RF state viScanf vi tli amp num Read the response integer value Print the on off RF state if num gt 0 printf Source RF state is on n else printf Source RF state is off n printf Ova printf Verify RF state then press continue n printf nt y getch viClear vi viPrintf vi OUTP STAT OFF n Turn source RF state off viPrintf vi OUTP n Query the signal generator s RF state viScanf vi 1i amp num Read the response Print the on off RF state if num gt 0 printf Source RF state is now on n telsel printf Source RF state is now off n Close the sessions printf Nn viClear vi viClose vi viClose defaultRM Generating an Externally Applied AC Coupled FM Signal Using VISA and C In this example the VISA library is used to generate an ac coupled FM signal at a carrier frequency of 46 Chapter 2 Programming Examples GPIB Programming Examples 700 MHz a power level of 2 5 dBm and a deviation of 20 kHz Before running the program Connect the output of a modulating signal source to the signal generator s EXT 2 input connector e Set the modulation signal source for the desired FM characteristics Launch Microsoft Visual C 6 0 add the required files and enter the code into your cpp source file The followin
31. RR oko kok k oko kok KCkCk kok k oko kok k kok OK ke ke command err commandInstrument sock command if command err return COMMAND ERROR JR RR RR RE RR RR RR RE RR RR RR XX AIR IRR kk k k k k k k EX ee Read response from signal generator eK kok k k oko kok o oko k kok k oko ko oko kok k oko k kok k IK I I EX count recv sock tmp buf 1 0 read 1 char ch tmp_buf 0 if count lt 1 ch EOF ch n result N0 null terminate result for ascii return 0 use a do while so we can break out do binary data encountered figure out what it is long numDigits long numBytes 0 Chapter 2 Programming Examples LAN Programming Examples char length 10 count recv sock tmp_buf 1 0 read 1 char ch tmp_buf 0 if count lt 1 ch EOF break End of file if ch lt 0 ch gt 9 break unexpected char numDigits ch 0 if numDigits read numDigits bytes into result string count recv sock result int numDigits 0 result count 0 null terminate numBytes atol result if numBytes resultBytes 0 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 recount recount recv sock result int numBytes 0 resultBytes rcount result recount Advance pointer while resultB
32. SCREEN Clears the controller s display OUTPUT Sig_gen RST Puts signal generator into a defined state OUTPUT Sig gen FREQ CW Querys the signal generator CW frequency setting ENTER Sig gen F Enter the CW frequency setting Print frequency setting to the controller display PRINT Present source CW frequency is F 1 E 6 MHz PRINT OUTPUT Sig gen POW AMPL Querys the signal generator power level ENTER Sig gen W Enter the power level Print power level to the controller display PRINT Current power setting is W dBM PRINT OUTPUT Sig gen FREQ MODE Querys the signal generator for frequency mode ENTER Sig gen A Enter in the mode CW Fixed or List Print frequency mode to the controller display PRINT Source s frequency mode is A PRINT OUTPUT Sig gen OUTP OFF Turns signal generator RF state off OUTPUT Sig gen OUTP72 Querys the operating state of the signal generator ENTER Sig gen B Enter in the state 0 for off Print the on off state of the signal generator to the controller display IF B 0 THEN Chapter 2 Programming Examples GPIB Programming Examples 390 PRINT Signal Generator output is on 400 ELSE 410 PRINT Signal Generator output is off 420 END IF 430 OUTPUT Sig_gen IDN Querys for signal generator ID 440 ENTER Sig gen C Enter in the signal generator ID 450 Print the signal generator ID to the controller display 460 PRINT 470 PRINT This
33. Status Byte Register that will trigger a service request Send the SRE num command where num is the sum of the decimal values of the bits you want to enable For example to enable bit 7 on the Status Byte Register so that whenever the Standard Operation Status register summary bit is set to 1 a service request is generated send the command SRE 128 Refer to Figure 3 1 on page 115 or Figure 3 2 on page 116 for bit positions and values The query command SRE returns the decimal value of the sum of the bits previously enabled with the SRE num command To query the Status Byte Register send the command STB The response will be the decimal sum of the bits which are set to 1 For example if bit 7 and bit 3 are set the decimal sum will be 136 bit 72128 and bit 3 8 NOTE Multiple Status Byte Register bits can assert an SRQ hovvever only one bit at a time can set the ROS bit All bits that are asserting an SRQ will be read as part of the status byte when it is queried or serial polled The SRQ process asserts SRQ as true and sets the status byte s RQS bit to 1 Both actions are necessary to inform the controller that the signal generator requires service Asserting SRQ informs the controller that some device on the bus requires service Setting the RQS bit allows the controller to determine which signal generator requires service This process is initiated if both of the following conditions are true e The corresponding
34. a deo eb seis cies si ee EE Gay Redes 30 Bele Using the Examples era ceres peses CBS SES PES ES DS DGE PES SE Eg pd os 30 Interface Check using Agilent BASIC 3 zb d db dd dp kbd ko bok do nd k dok dod dok ga ira dia 31 Interface Check Using NE88 2 atid CHF ago pad eba Food k sd dna i essa passades 22 Contents Intertace heck usmg VISA SE o aeo eee Erbe pti b KbTE xke bebe dh A EE db d dd 33 Local Lockout Using Amlent BASIC svazku pekn k k da RAT PER ES 34 Local Lockout Using NI 4388 2 and CFF essa dure aa gene I RU Ro Y RR UR Reb RR 36 Quenes Using Amlent BASIC sece z esate ehe eR ES SORTEO SR past PU d RP ER ACCU bas OES 37 Queries Using INI 488 2 and Us io esa pea ECRIRE RODE RSS BP ER EQ REPE ER ORE 39 Ouenes Usine VISA QE dod RA d PE HERES I EE Hee nee Rb dddeqe Heda 42 Generating a CW Signal Using VISA d onosesyeterrepet ss ene SS se gasa Gens PRESE 44 Generating an Externally Applied AC Coupled FM Signal Using VISA andC 46 Generating an Internal AC Coupled FM Signal Using VISA and C 49 Generating a Step Swept Signal Using VISA and C 00 eee eee eee ees 51 Saving and Recalling States Using VISA and C 42 44 civic este es desar m RR oes 52 Reading the Data Questionable Status Register Using VISA and C 39 Reading the Service Request Interrupt SRO Using VISA and C 60 Using 6737 Pass Thri CODI coi thea EE ES ES SS
35. byte header associated with it There must be enough bytes to contain the specified number of bits If the number of bits is not a multiple of 8 the least significant bits of the last byte are ignored For example specifying 14 bits of a16 bit string using the command MEMory DATA BIT file name 14 12Qz results in the last 2 bits being ignored See the following figure 010 0001 0111 1010 original user defined data contains 2 bytes 16 bits total SCPI command sets bit count to 14 the last 2 bits are ignored 010 0001 0111 1060 A bit directory provides more versatility and is the preferred memory location for user file downloads SCPI Commands Send the following command to download the user file data into the signal generator s bit directory MEMory DATA BIT lt file name gt bit count lt datablock gt Example MEMory DATA BIT file name 16 12Qz file name provides the user file name as it will appear in the signal generator s bit catalog 1 1 decimal digits will be used to define the number of data bytes 2 2 bytes of data will follow Qz the ASCII representation of the 16 bits of data that are downloaded to the signal generator 176 Chapter 4 Downloading and Using Files Downloading User File Data Querying the Waveform Data Use the following SCPI command to query user file data from a binary directory MEMory DATA BIT file name gt The output format is the sa
36. bytes and the binary memory stores data in 8 bit bytes If the length in bits of the original data pattern is not a multiple of 8 you may need to e add additional bits to complete the ASCII character replicate the data pattern without discontinuity until the total length is a multiple of 8 bits e truncate and discard bits until you reach a string length that is a multiple of 8 or e use a bit file and download to bit memory instead 3 Download size limitations are directly proportional to the available memory space and the signal generator s pattern RAM size 128 megabytes You may have to delete files from memory before downloading larger files If the data fields absolutely must be continuous data streams and the size of the data exceeds the available PRAM then real time data and synchronization can be supplied by an external data source to the front panel DATA DATA CLOCK and SYMBOL SYNC connectors Chapter 4 175 Downloading and Using Files Downloading User File Data Bit and Binary Directories User files can be downloaded to a bit or binary directory in either volatile or non volatile memory Bit Directory Downloads The bit directory user bit accepts data in integer number of bits up to the maximum available memory The data length in bytes for files downloaded to bit memory is equal to the number of significant bits plus seven divided by eight then rounded down to the nearest integer Each file has a 16
37. ck Ck Ck Ck Ck Ck ck ck KKK KKK KKK include stdafx h include lt iostream gt include windows h include Decl 32 h using namespace std int GPIBO 0 Board handle Addr4882_t Address 31 Declares a variable of type Addr4882_t int main int sig Declares variable to hold interface descriptor sig ibdev 0 19 0 13 1 0 Opens and initialize a device descriptor ibclr sig Sends GPIB Selected Device Clear SDC message 36 Chapter 2 Programming Examples GPIB Programming Examples ibwrt sig RST 4 Places signal generator in a defined state cout lt lt The signal generator should now be in REMOTE The remote mode R endl cout annunciator should appear on the signal generator display endl cout Press Enter to continue endl cin ignore 10000 n SendIFC GPIBO Resets the GPIB interface Address 0 19 Signal generator s address Address 1 NOADDR Signifies end element in array Defined in DECL 32 H SetRWLS GPIBO Address Places device in Remote with Lockout State cout lt lt The signal generator should now be in LOCAL LOCKOUT Verify that all keys lt lt endl cout lt lt including the Local key are disabled Contrast keys are not affected lt lt endl cout lt lt Press Enter to continue lt lt endl cin ignore 10000 Xn ibloc sig Returns signal generator to local control cout lt lt endl cout lt lt The s
38. fflush stdout else commandInstrument instSock charBuf if number numbert if show errs showErrors instSock ifdef WINSOCK 96 Chapter 2 Programming Examples LAN Programming Examples closesocket instSock close winsock else close instSock endif WINSOCK return 0 End of lanio cpp RRR ok k kok k KR KKK I Kk Ck IK KK I o EE RR EE RE KK Ck Ck Kk Ck Kk Ck Kk Ck Kk Ck ko IRR k ke ke ke ke ke Function mainl x Description Output a series of SCPI commands to the signal generator Send query results to stdout SReturn int non zero if an error occurs ROR RK kok k EE RR EE Kk Ck Kk Ck Kk Ck RR EE RR ERROR RE RE Kk oko k oko kok RE k EE ke RR ke ke ke ke Rename this int mainl function to int main Re compile and the y execute the program P e e kok ok RE RR RR RE RR EE RR kok o kok o oko kok k oko k oko KC Kk Ck KC Kk Ck RR IR ko k ke RR kok XX RX int mainl SOCKET instSock long bufBytes char charBuf char malloc INPUT BUF SIZE Chapter 2 97 Programming Examples LAN Programming Examples RRR KK RK kok k kok kk kok k ERROR RX RX XX kk ke XXX e e open a socket connection to the instrument RRR KK KKK k kok KK IK kok k kk k IR I XXX e e ifdef WINSOCK if init_winsock 0 exit 1 endif WINSOCK instSock openSocket xxxxxx SCPI PORT
39. file from Matlab to the PSG vector signal generator s volatile memory When using the Download Assistant with Matlab the I O interface definition and the download command are embedded in the M file program see the programming example in Waveform Generation Using MATLABS on page 157 To download the waveform to the signal generator execute the program in the Matlab command window by entering the name of the M file for example pulsepat at the command prompt The Download Assistant will be instructed to download the waveform file to the signal generator For more information about the Download Assistant go to www agilent com and search for Download Assistant in Test amp Measurement NOTE This example uses the GPIB interface to download waveforms Make sure that the GPIB interface is working properly between the signal generator and the computer before downloading See the programming guide for more information about using GPIB and other interfaces Chapter 4 161 Downloading and Using Files Downloading ARB Waveform Data Waveform Generation Using C The following program Metrowerks CodeWarrior 3 0 creates an I Q waveform and writes the data to a file on your PC Once the file is created you can use the file transfer protocol FTP to download the waveform data to the signal generator Refer to Using FTP on page 157 for more information on FTP include lt iostream gt include lt fstream gt include lt math
40. gives negative full scale output e 32767 gives positive full scale output Each I Q waveform must contain at least 60 samples to play in the waveform sequencer one sample equals one pair of I Q values and markers If this requirement is not met the signal analyzer displays File format invalid The file format is discussed in greater detail in the following sections If a waveform file is too large to fit into a 1024 byte memory segment additional memory space is allocated in multiples of 1024 bytes For example a waveform represented by 500 samples is allocated to a 2048 byte memory segment 500 samples x 4 bytes a 60 sample waveform file occupies 1024 bytes of waveform memory Total memory usage may be much more than the sum of the samples that make up waveform files many small waveform files can use large amounts of memory Each I Q waveform must contain an even number of samples to play in the waveform sequencer If this requirement is not met the signal analyzer displays File format invalid A marker file is always associated with an I Q waveform file An empty all zeros default marker file is created if a marker file is not provided by the user NOTE The default marker file is automatically created when the I Q waveform file is loaded into 154 volatile WFM1 waveform memory prior to playing If the default marker file is used toggle the Mrk 2 to RF Blank softkey to off The user defined marker file and I Q wavef
41. gt include StdAfx h include lt stdlib h gt Chapter 2 33 Programming Examples GPIB Programming Examples void main ViSession defaultRM vi Declares a variable of type ViSession for instrument communication ViStatus viStatus 0 Opens a session to the GPIB device at address 19 viStatus viOpenDefaultRM amp defaultRM viStatus viOpen defaultRM GPIB 19 INSTR VI NULL VI NULL amp vi if viStatus printf Could not open ViSession Mn printf Check instruments and connections Mn printf Mn exit 0 viPrintf vi RSTX n initializes signal generator prints to the output window printf The signal generator should now be in REMOTE The remote indicator n printf annunciator R should appear on the signal generator display n printf Nn viClose vi closes session viClose defaultRM closes default session Local Lockout Using Agilent BASIC This example demonstrates the Local Lockout function Local Lockout disables the front panel signal generator keys The following program example is available on the PSG Documentation CD ROM as basicex2 txt 10 V OKCKCK CK KK Ck Kk K A RE A KA KA Ck CK A KA Ck Ck CK A KA Ck Ck kk A KA KA kk kk kc kk kk ck kck ck ck ck ck ck ckck kck ck ck ck kck ck ck ck ck ck k 20 30 PROGRAM NAME basicex2 txt 34 Chapter 2 40 50 60 70 80 90 00 10 20 30 40 50 60 70 80 220
42. h gt include lt stdlib h gt using namespace std int main void ofstream out_stream write the I Q data to a file const unsigned int SAMPLES 200 number of sample pairs in the waveform const short AMPLITUDE 32000 amplitude between 0 and full scale dac value const double two_pi 6 2831853 allocate buffer for waveform short iqData new short 2 SAMPLES need two bytes for each integer if iqData cout lt lt Could not allocate data buffer lt lt endl return 1 out_stream open IQ_data create a data file if out stream fail cout lt lt Input file opening failed lt lt endl exit 1 generate the sample data for I and Q The I channel will have a sine 162 Chapter 4 Downloading and Using Files Downloading ARB Waveform Data wave and the Q channel will a cosine wave for int i 0 i lt SAMPLES i iqData 2 i AMPLITUDE sin two_pi i float SAMPLES igData 2 i 1 AMPLITUDE cos two_pi i float SAMPLES make sure bytes are in the order MSB most significant byte first PC only char cptr char iqData cast the integer values to characters for int i20 i lt 4 SAMPLES i 2 4 SAMPLES char temp cptr i swap LSB and MSB bytes cptr i l cptr i 1 cptr i 1 temp now write the buffer to a file out stream write char iqData 4 SAMPLES return 0 Downloading Using C The following program uses the
43. if posn if scan 0 optarg scan scan NULL else optarg argv optind optind return c Sockets LAN Programming Using PERL This example uses PERL script to control the signal generator over the sockets LAN interface The signal generator power level is set to 5 dBm queried for operation complete and then queried for it s identify string This example was developed using PERL version 5 6 0 and requires a PERL version with the 10 Socket library This example is available on the PSG Documentation CD ROM as perl txt 1 Programming Examples LAN Programming Examples In the code below enter your signal generator s hostname in place of the xxxxx in the code line my SinstrumentName xxxxx Chapter 2 101 Programming Examples LAN Programming Examples 2 Save the code using the filename lanperl 3 Run the program by typing perl lanperl at the UNIX term window prompt Setting the Power Level and Sending Queries Using PERL usr bin perl PROGRAM NAME perl txt Example of talking to the signal generator via SCPI over sockets use IO Socket Change to your instrument s name my SinstrumentName xxxxx Get socket Ssock new IO Socket INET PeerAddr gt instrumentName PeerPort gt 7777 Proto gt tcp i die Socket Could not be created Reason n unless sock Set freq print Setting frequency n print sock freq 1 GH
44. ijo i fa lu ls o summary cje c S o le From Baseband Operation Status Group summary z 5 H gt o 8 summary Unused Unused Always Zero 0 Oper Complete Reg Bus Control Query Error Dev Dep Error Execution Error Command Error User Request Povver On WA CALibrating Settling Unused SWEeping MEASuring Waiting for TRIGer Unused Unused Unused DCFM DCIM Nullin Progress rans Filter vent Register Event Enable Reg T Service Reguest stat reg_2of2 Always Zero 0 Enable Register 116 Chapter 3 Programming the Status Register System Status Register Bit Values Status Register Bit Values Each bit in a register is represented by a decimal value based on its location in the register see Table 3 1 e To enable a particular bit in a register send its value with the SCPI command Refer to the signal generator s SCPI command listing for more information e To enable more than one bit send the sum of all the bits that you want to enable e To verify the bits set in a register query the register Example Enable a Register To enable bit 0 and bit 6 of the Standard Event Status Group s Event Register 1 Add the decimal value of bit 0 1 and the decimal value of bit 6 64 to give a decimal value of 65 2 Send the sum with the command ESE 65 Example Query a Register To query a register for a condition send a SCPI query command For example if you want t
45. is available on the PSG Documentation CD ROM as visaex7 cpp J RR RRR RK KR KKK IK KR IKK KKK IKK IKK I IKK IKK KK IRR IA IR RR RE EE RR RR RE RR RII II EX IH PROGRAM FILE NAME visaex7 cpp PROGRAM DESCRIPTION This example will program the signal generator to perform a step sweep from 500 800 MHz with a 5 sec dwell at each frequency step JKR RK KR KK IK o oko k o A RR KR RR k kok k k kok k kok kok kok k k kok k k EE RE IRR RR EE kok kok kok k kok k kok kok k kok ke ke ke include lt visa h gt include StdAfx h include lt iostream gt void main ViSession defaultRM vi Declares variables of type ViSession vi establishes instrument communication ViStatus viStatus 0 Declares a variable of type ViStatus for GPIB verifications viStatus viOpenDefaultRM amp defaultRM Initialize VISA session Open session to GPIB device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI NULL VI NULL amp vi if viStatus If problems then prompt user printf Could not open ViSession n printf Check instruments and connections Mn Chapter 2 51 Programming Examples GPIB Programming Examples printf Anty exit 0 viClear vi Clears the signal generator viPrintfi vi RSTin Resets the signal generator viPrintf vi OLSXn Clears the status byte register viPrintf vi FREQ MODE LIST n Sets the sig gen freq mode to list viPrintf vi LIST TYPE
46. negative transition or STATus QUEStionable PTRansition value positive transition where value is the sum of the decimal values of the bits you want to enable Queries STATus QUEStionable NTRansition STATus QUEStionable PTRansition Data Questionable Event Register The Data Questionable Event Register latches transition events from the condition register as specified by the transition filters Event registers are destructive read only reading data from an event register clears the contents of that register Query STATus QUEStionable EVENt Data Questionable Event Enable Register The Data Questionable Event Enable Register lets you choose which bits in the Data Questionable Event Register set the summary bit bit 3 of the Status Byte Register to 1 Command STATus QUEStionable ENABle value command where value is the sum of the decimal values of the bits you want to enable Example Enable bit 9 and bit 3 so that whenever either of those bits is set to 1 the Data Questionable Status summary bit of the Status Byte Register is set to 1 send the command STAT QUES ENAB 520 512 8 Query STATus QUEStionable ENABle Response Decimal value of the sum of the bits previously enabled with the STATus QUEStionable ENABle value command Chapter 3 137 Programming the Status Register System Status Groups Data Questionable Pow
47. non volatile memory is not partitioned non volatile waveform memory NVWFM and non volatile marker memory NVMKR share the same space along with bit binary and state directories NVWE data is stored in the signal generator s user waveform directory NVMRR data is stored in the signal generator s user markers directory NOTE To be sequenced and played waveforms stored in non volatile waveform memory 152 NVWFM must be moved to volatile waveform memory WFM1 Chapter 4 Downloading and Using Files Downloading ARB Waveform Data Downloading ARB Waveform Data The signal generator accepts I Q waveform data downloads User defined I Q waveforms can be sequenced together with other waveforms and played as part of a waveform sequence see the User s Guide for details on sequencing waveforms The signal generator uses a two file format when generating waveform data an I Q waveform file and a marker file If you do not create a marker file for the I Q waveform file the signal generator automatically creates one This automatically generated default marker file comprises all zeros The marker data drives the signal generator s rear panel EVENT output connectors Marker bit 1 drives EVENT 1 BNC Marker bit 2 drives EVENT 2 BNC e Marker bit 3 drives EVENT 3 Auxiliary D Connector pin 19 e Marker bit 4 drives EVENT 4 Auxiliary D Connector pin 18 The I Q waveform data usually drives the I and Q ports of the
48. or IP address 64 10 where hostname or IP address is your instrument s name or IP address 64 is the packet size and 10 is the number of packets transmitted Type man ping at the UNIX prompt for details on the ping command From the MS DOS Command Prompt or Windows environment type ping n 10 hostname or IP address where hostname or IP address is your instrument s name or IP address and 10 is the number of echo requests Type ping at the command prompt for details on the ping command NOTE In DHCP mode if the DHCP server uses dynamic DNS to link the hostname with the assigned IP address the hostname may be used in place of the IP address Otherwise the hostname is not usable and you must use the IP address to communicate with the signal generator over the LAN UNIX is a registered trademark of the Open Group MS DOS is a registered trademark of M icrosoft Corporation 14 Chapter 1 Table 1 5 Getting Started Using LAN Ping Responses Normal Response for UNIX A normal response to the ping command will be a total of 9 or 10 packets received with a minimal average round trip time The minimal average will be different from network to network LAN traffic will cause the round trip time to vary widely Normal Response for DOS or Windows A normal response to the ping command will be a total of 9 or 10 packets received if 10 echo requests were specified Error Messages If error messages appear
49. path is used to send ASCII data to the signal generator 140 Opens an I O path for sending binary data to the signal generator 150 Creates an ASCII string representation of the number of bytes in the waveform 160 to 170 Finds the number of digits in Nbytes 190 Sends the first part of the SCPI command MEM DATA along with the name of the file data file that will receive the waveform data The name data_file will appear in the signal generator s memory catalog 200 to 210 Sends the rest of the ASCII header 230 Sends the binary data Note that P sgb is the binary I O path 240 Sends an End of Line to terminate the transmission 250 to 260 Closes the connections to the signal generator 290 End the program Downloading Using HP BASIC for UNIX The following program uses HP BASIC for UNIX to download waveforms The code is similar to that shown for Downloading Using HP BASIC for Windows on page 166 but there is a formatting difference in line 130 and line 140 As discussed at the beginning of this section I and Q waveform data is interleaved into one file in 2 s compliment form and a marker file is associated with this I Q waveform file In the Output commands USING 4 K formats the data The pound symbol suppresses the automatic end of line EOL output This allows multiple output commands to be concatenated as if they were a single output The K instructs HP B
50. source 1 underrange modulation source 1 overrange modulation source 2 underrange modulation source 2 overrange modulation uncalibrated See the Data Questionable Modulation Status Group on page 144 for more information 8 Calibration summary This is a summary bit taken from the QUEStionable CA Libration register A 1 in this bit position indicates that one of the following may have happened an error has occurred in the DCFM DC9M zero calibration an error has occurred in the I Q calibration See the Data Questionable Calibration Status Group on page 147 for more information 9 Self Test A 1 in this bit position indicates that a self test has failed during power up This bit can only be cleared by cycling the signal generator s line power CLS will not clear this bit 10 14 Unused These bits are always set to 0 15 Always 0 136 Chapter 3 Programming the Status Register System Status Groups Query STATus QUEStionable CONDition Response The decimal sum of the bits that are set to 1 Example The decimal value 520 is returned The decimal sum 512 bit 9 8 bit 3 Data Questionable Transition Filters negative and positive The Data Questionable Transition Filters specify which type of bit state changes in the condition register set corresponding bits in the event register Changes can be positive 0 to 1 or negative 1 to 0 Commands STATus QUEStionable NTRansition value
51. the Data Questionable Condition register to 1 Command STATus QUEStionable CALibration ENABle value where value is the sum of the decimal values of the bits you want to enable Example Enable bit 9 and bit 3 so that whenever either of those bits is set to 1 the Data Questionable Calibration summary bit of the Data Questionable Condition Register is set to 1 send the command STAT QUES CAL ENAB 520 512 8 Query STATus QUEStionable CALibration ENABle Response Decimal value of the sum of the bits previously enabled with the STATus QUEStionable CALibration ENABle value command Chapter 3 149 Programming the Status Register System Status Groups 150 Chapter 3 4 Downloading and Using Files Computer generated data can be downloaded into the signal generator Depending on the options present the signal generator can accept ARB waveform data user file data FIR filter coefficient data and data downloads directly to waveform memory This section explains signal generator memory and the different waveform download methods e Types of Memory on page 152 Downloading ARB Waveform Data on page 153 Understanding ARB Waveform File Composition and Encryption on page 172 Downloading User File Data on page 174 Downloading FIR Filter Coefficients on page 179 Downloading Directly into Pattern RAM PRAM on page 182 NOTE The procedures in this chapt
52. using the PSG ESG Download Assistant IQData i a define a marker matrix and activate a marker to indicate the beginning of the waveform Markers zeros 2 length IQData X 96 fill marker array with zero i e no markers set Markers 1 1 1 set marker to first point of playback make a new connection to the PSG over the GPIB interface io agt_newconnection gpib 0 19 verify that communication with the PSG has been established status status description query result agt query io idn if status 0 return end set the carrier frequency and power level on the PSG using the PSG Download Assistant Chapter 4 159 Downloading and Using Files Downloading ARB Waveform Data status status description agt sendcommand io SOURce FREQuency 20000000000 status status description agt sendcommand io POWer 05 define the ARB sample clock for playback sampclk 40000000 download the iq waveform to the PSG baseband generator for playback status status description agt waveformload io IQData pulsepat sampclk play no normscale Markers turn on RF output power status status description agt sendcommand io OUTPut STATe ON You can test your program by performing a simulated plot of the in phase modulation signal in Matlab see Figure 4 1 on page 160 To do this enter plot i atthe Matlab command prompt Figure 4 1 Simulated Plot of In Phase Signal
53. using the IEEE 488 2 common commands listed below You can set and query individual status registers using the commands in the STATus subsystem CLS clear status clears the Status Byte Register by emptying the error queue and clearing all the event registers ESE ESE event status enable sets and queries the bits in the Standard Event Enable Register which is part of the Standard Event Status Group ESR event status register queries and clears the Standard Event Status Register which is part of the Standard Event Status Group OPC OPC operation complete sets bit 0 in the Standard Event Status Register to 1 when all commands have completed The query stops any new commands from being processed until the current processing is complete then returns a 1 PSC PSC power on state clear sets the power on state so that it clears the Service Request Enable Register the Standard Event Status Enable Register and device specific event enable registers at power on The query returns the flag setting from the PSC command SRE SRE service request enable sets and queries the value of the Service Request Enable Register STB status byte queries the value of the status byte register without erasing its contents STATus PRESet presets all transition filters non IEEE 488 2 enable registers and error event queue enable registers Refer to Table 3 2 Chapter 3 121 Programming the Status Register System Accessing Sta
54. your network Problems of this nature are best resolved by your IT department Chapter 1 15 Getting Started Using LAN Using VXI 11 The signal generator supports the LAN interface protocol described in the VXI 11 standard VXI 11 is an instrument control protocol based on Open Network Computing Remote Procedure Call ONC RPC interfaces running over TCP IP It is intended to provide GBIB capabilities such as SRQ Service Request status byte reading and DCAS Device Clear State over a LAN interface This protocol is a good choice for migrating from GPIB to LAN as it has full Agilent VISA SICL support See the VXI website www vsi org for more information and details on the specification Configuring for VXI 11 The Agilent I O library has a program I O Config that is used to setup the computer signal generator interface for the VXI 11 protocol Download the latest version of the Agilent I O library from the Agilent website Refer to the Agilent I O library user manual documentation and Help menu for information on running the I O Config program and configuring the VXI 11 interface Use the I O Config program to configure the LAN client Once the computer is configured for a LAN client you can use the VXI 11 protocol and the VISA library to send SCPI commands to the signal generator over the LAN interface Example programs for this protocol are included in LAN Programming Examples on page 68 of this programming guide N
55. 0 15 Always 0 Query STATus QUEStionable CALibration CONDition Response The decimal sum of the bits set to 1 Data Questionable Calibration Transition Filters negative and positive The Data Questionable Calibration Transition Filters specify which type of bit state changes in the condition register set corresponding bits in the event register Changes can be positive 0 to 1 or negative 1 to 0 Commands STATus QUEStionable CALibration NTRansition value negative transition or STATus QUEStionable CALibration PTRansition value positive transition where value is the sum of the decimal values of the bits you want to enable Queries STATus QUEStionable CALibration NTRansition STATus QUEStionable CALibration PTRansition Data Questionable Calibration Event Register The Data Questionable Calibration Event Register latches transition events from the condition register as specified by the transition filters Event registers are destructive read only Reading data from an event register clears the content of that register Query STATus QUEStionable CALibration EVENt 148 Chapter 3 Programming the Status Register System Status Groups Data Questionable Calibration Event Enable Register The Data Questionable Calibration Event Enable Register lets you choose which bits in the Data Questionable Calibration Event Register set the summary bit bit 8 of
56. 0 FOR I 2 TO Num points 2 STEP 2 90 Int array 1 INT 32767 COS I 360 Num points 100 NEXT I 166 Chapter 4 10 20 30 40 50 60 70 PRINT Data Generated Nbytes 4 Num_points ASSIGN Psg TO 719 ASSIGN Psgb TO 719 FORMAT MSB FIRST Nbytes VALS Nbytes Ndigits LEN Nbytes Ndigits VAL Ndigits WAIT OUTPUT Psg USING K MMEM DATA WFMl data file 4 OUTPUT Psg USING K Ndigits OUTPUT Psg USING K Nbytes WAIT OUTPUT Psgb Int_array OUTPUT Psg END ASSIGN Psg TO ASSIGN Psgb TO PRINT PRINT END END Program Comments Downloading and Using Files Downloading ARB Waveform Data 10 Program file name 20 Sets the number of points in the waveform 30 Allocates integer data array for I and Q waveform points 40 Sets HP BASIC to use degrees for cosine and sine functions 50 Sets up first loop for I waveform points 60 Calculate and interleave I waveform points 70 End of loop 80 Sets up second loop for Q waveform points 90 Calculate and interleave Q waveform points 100 End of loop 120 Calculates number of bytes in I Q waveform Chapter 4 167 Downloading and Using Files Downloading ARB Waveform Data Program Comments Continued 130 Opens an I O path to the signal generator using GPIB 7 is the address of the GPIB card in the computer and 19 is the address of the signal generator This I O
57. 1 Situs Ds TO OU cane ee as dir depu maie O dependet rh esha abanico pi ab Rab wap ts a pus solutus Die RESIST cintes so ge leseeeesieledeese det hedensgoekebdag bone yi Nac pe d 124 Service Request Enable BeSIBISE ose Sed hg LES dor Boje d ees deda ddd ibd 125 Satis GOU ee Qd eroe RA GE RR o apiid 126 Contents SINCE Eveni Sais COUR 65 adi eee Rabe Eb i EE EE RE bees rb eS didi ea biis 127 Standard Operation Status DIOUD is cceka deci ogee hehe aseoer ews seeederuadaghedexe ds 129 Baseband Operation SCIMUS QUOND errer eee eee beaten ue ba dire de CUP ie Gates oo 132 Data Questionable Status P ics dee ete etch ea eR o Rea be UR pea Re HER d 135 Data Questionable Power Status Group va ele ins sacmasaraasaasmaacas sexe uuasae 138 Data Questionable Frequency Status Grup abso RS E ERES EE RP ERE REEL osa iteki 141 Data Questionable Modulation Status Group 5 22 ses0 aseseseeensaceteaeeeens 144 Data Questionable Calibration Status Group isses abso RR RRRR E IE ER REPE ERES S 147 4 Downloading and Using Files 1225552545255532422242242a22adA4adasauauauanawauaseuu RD Typs car MENDY dada d d bei ardet teri Ec batte eR i ba dbi dediti edt 152 Downloading ARB Waverorm Dale sccccle sas eis gent oe REA LREERCKRSRRSEEDAA RE ES 153 Data Regmiremente dnd LT PUM i iced ber ea ob be thee boa EEEIEE 154 Downloading Wavefotms ssri gine te RARE EEES LE R ERRE ERA SURE PR UR R 155 Loading and Playing a Downloaded Waveform 6 0 0 0
58. 11 BASIC ABORT 8 CLEAR 10 ENTER 11 LOCAL 10 LOCAL LOCKOUT 9 OUTPUT 11 REMOTE 9 binary directory downloading to 177 bit directory downloading to 176 bit status how and what to monitor 118 bit values 117 C C C include files 29 clear command 10 clear function 10 CLS command 121 command prompt 14 103 commands 8 9 10 11 Index computer interfaces 3 condition registers description 126 controller 7 D data directories 152 176 volatility 152 data questionable filters calibration transition 148 frequency transition 142 modulation transition 145 power transition 139 transition 137 data questionable groups calibration status 147 frequency status 141 modulation status 144 power status 138 status 135 data questionable registers calibration condition 148 calibration event 148 calibration event enable 149 condition 136 event 137 event enable 137 frequency condition 142 frequency event 143 frequency event enable 143 modulation condition 145 modulation event 146 modulation event enable 146 power condition 139 power event 139 power event enable 140 DHCP 13 directories bit and binary 176 marker 152 waveform 152 DNS 14 DOS prompt 17 download libraries 6 12 downloading Index 187 Index ARB waveform data 172 encrypted ARB waveform files 173 echo lack of 20 EnableRemote 9 encryption 172 enter function 11 erro
59. 65 register system overview 114 registers See also status registers condition description 126 data questionable calibration condition 148 data questionable calibration event 148 data questionable calibration event enable 149 data questionable condition 136 data questionable event 137 data questionable event enable 137 data questionable frequency condition 142 data questionable frequency event 143 data questionable frequency event enable 143 Index 189 Index data questionable modulation condition 145 data questionable modulation event 146 data questionable modulation event enable 146 data questionable power condition 139 data questionable power event 139 data questionable power event enable 140 in status groups descriptions 126 overall system 115 116 standard event status 128 standard event status enable 128 standard operation condition 130 133 standard operation event 131 133 standard operation event enable 131 134 status byte 124 remote annunciator 106 function 8 interface overview 2 RS 232 22 RS 232 address 106 baud rate 23 cable 23 configuration 23 echo 23 format parameters 24 interface 23 interface description 3 IO libraries 22 overview 22 program examples 106 settings baud rate 106 verifying operation 24 S SCPI commands ARB waveform file downloads example programs C 163 HP BASIC for UNIX 168 HP BASIC for Windows 157 166 status registers 121
60. 801p1 IP 888 000 00 000 SCPI gt IDN Agilent Technologies E8254A USO0009005 C 01 00 SCPI gt RST SCPI gt POW RMPL 10 dba SCPI Pow 1 08880880806t 981 SCPI gt B The Standard UNIX TELNET Command Synopsis telnet host port Description This command is used to communicate with another host using the TELNET protocol When the command telnet is invoked with host or port arguments a connection is opened to the host and input is sent from the user to the host Options and Parameters The command telnet operates in character at a time or line by line mode In line by line mode typed text is echoed to the screen When the line is completed by pressing the Enter key the text line is sent to host In character at a time mode text is echoed to the screen and sent to host as it is typed At the UNIX prompt type man telnet to view the options and parameters available with the telnet command NOTE If your TELNET connection is in line by line mode there is no local echo This means you cannot see the characters you are typing until you press the Enter key To remedy this change your TELNET connection to character by character mode Escape out of TELNET and at the telnet gt prompt type mode char If this does not work consult your TELNET program s documentation Chapter 1 19 Getting Started Using LAN Unix TELNET Example To connect to the instrument with host name myInstrument and port number 7778
61. ASIC to output the following numbers or strings in the default format 10 RE SAVE UNIX file 20 Num points 200 30 ALLOCATE INTEGER Int array 1 Num points 2 40 DEG 50 FOR I 1 TO Num points 2 STEP 2 60 Int array I INT 32767 SIN I 360 Num points 70 NEXT I 80 FOR I 2 TO Num points 2 STEP 2 90 Int array 1 INT 32767 COS I 360 Num points 100 NEXT I 168 Chapter 4 80 WAIT 90 OUTPUT 200 OUTPUT 210 OUTPUT 220 WAIT 230 OUTPUT 240 WAIT 2 241 OUTPUT 250 ASSIGN 260 ASSIGN 270 PRINT 280 PRINT 290 END 10 PRINT Data generated 20 Nbytes 4 Num_points 30 ASSIGN Psg TO 719 FORMAT ON 40 ASSIGN Psgb TO 719 FORMAT OFF 50 Nbytes VALS Nbytes 60 Ndigits LEN Nbytes 70 Ndigits VAL Ndigits Psg USING K MMEM DATA WFMl data file 4 Psg USING K Ndigits GPsg USING K Nbytes Psgb Int_array Psg END Psg TO Psgb TO END Program Comments Downloading and Using Files Downloading ARB Waveform Data 10 Program file name 20 Sets the number of points in the waveform 30 Allocates integer data array for I and Q waveform points 40 Sets HP BASIC to use degrees for cosine and sine functions 50 Sets up first loop for I waveform points 60 Calculate and interleave I waveform points 70 End of loop 80 Sets up second loop for Q waveform points 90 Calculate and interleave Q waveform po
62. AT OPER BAS ENAB 520 512 8 Query STATus OPERation BASeband ENABle Response Decimal value of the sum of the bits previously enabled with the STATus OPERation BASeband ENABle value command 134 Chapter 3 Programming the Status Register System Status Groups Data Questionable Status Group The Data Questionable Status Group is used to determine the specific event that set bit 3 in the Status Byte Register This group consists of the Data Questionable Condition Register the Data Questionable Transition Filters negative and positive the Data Questionable Event Register and the Data Questionable Event Enable Register Unused Unused Unused POWer summary TEMPerature OVEN COLD FREQuency summary Unused MODulation summary CALibration summary SELFtest Unused Unused BERT summary Unused Unused Always Zero 0 Data QUEStionable Condition Register 15 14 13 12 11109 87 654 3 2 1 Data QUEStionable Dl NM 15 14 13 12 11109 87 6 5 4 3 21 0 Data QUEStionable TL X V Y X VY Y Y Y Y Y v Negative 15 14 13 12 131109 87 654 3 21 0 Transition Filter dria Data QuESdensPle 15 14 18 12 1110987654321 0 Event Register 15 14 18 12 4 1009 876 854 3 2 1 0 14 13 12 11 109 8765 4 3 2 1 Data QUEStionable En Event Enable Register 15 14 13 12 1110 9 8 7 To Status Byte Register Bit 3 ck722k Chapter 3 135 Programming the Status Register System Status Groups Data Questionable Condition Regi
63. Agilent VISA VISA National Instruments Agilent SICL NI 488 2 Library Agilent GPIB NI PCI GPIB Interface Card Interface Card ce910a 2 Chapter 1 Interfaces GPIB LAN RS 232 IO Libraries Getting Started Introduction to Remote Operation GPIB is used extensively when a dedicated computer is available for remote control of each instrument or system Data transfer is fast because the GPIB handles information in 8 bit bytes GPIB is physically restricted by the location and distance between the instrument system and the computer cables are limited to an average length of two meters per device with a total length of 20 meters LAN based communication is supported by the signal generator Data transfer is fast as the LAN handles packets of data The distance between a computer and the signal generator is limited to 100 meters 10BASE T The following protocols can be used to communicate with the signal generator over the LAN e VMEbus Extensions for Instrumentation VXI as defined in VXI 11 e Sockets LAN Telephone Network TELNET File Transfer Protocol FTP RS 232 is acommon method used to communicate with a single instrument its primary use is to control printers and external disk drives and connect to a modem Communication over RS 232 is much slower than with GPIB or LAN because data is sent and received one bit at a time It also requires that certain parameters such as baud rate be matched on both the comp
64. BG1 WAVEFORM file name gt ABC markers file MMEM DATA USER BBG1 MARKERS file name gt ABC Downloads to NVWFM Using the GPIB or LAN interface Use the following SCPI commands waveform file MMEM DATA NVWFM lt file name gt ABC markers file MMEM DATA NVMKR file name gt ABC The full directory path name can be specified in the command line The following SCPI commands are equivalent to the previous commands waveform file MMEM DATA USER WAVEFORM file name gt ABC markers file MMEM DATA USER MARKERS file name gt ABC 156 Chapter 4 Downloading and Using Files Downloading ARB Waveform Data Using FTP 1 From the PC Command Prompt or Unix command line change the directory to the directory where the file to be downloaded is located 2 From the PC Command Prompt or Unix command line type ftp instrument name Where instrument name is the signal generator s hostname or IP address 3 Atthe User prompt in the ftp window press the Enter key no entry is required 4 Atthe Password prompt in the ftp window press the Enter key no entry is required 5 Atthe ftp prompt type put file name USER WAVEFORM file name 1 where ile name is the name of the file to download and ile name 1 the name designator for the signal generator s USER WAVEFORM directory If you have a marker file associated with the data file use t
65. Ck KC Kk Ck kk k kok kok kok k kok k kk k kk k k k k ke kk k ko EX k k kk XX ke koc ke ke ke ke ek void showErrors SOCKET sock const char command SYST ERR n char result_str 256 do queryInstrument sock command result str sizeof result str 1 RK RK KK IKK I RR RR RE kk oko Kk A RR EE RE Kk Ck Kk k k RE Kk Ck k kok k k kok k ko IO o Typical result str 221 Settings conflict Frequency span reduced 0 No error Don t bother decoding KK RK IK KKK IK k kok k k oko k IK RR EE RR kok k kk k I KR RX RR ke ke RX if strncmp result str 0 3 0 Matched 0 No error Chapter 2 89 Programming Examples LAN Programming Examples break puts result str while 1 RRR KK KKK KKK I RR ERROR RE RR EE RR EE RE RR EE RE RE Kk K Kk A k Kk Ck RR k kok k oko kok k k ke ke ke gt Function isQuery SDescription Test current SCPI command to see if it a query SReturn unsigned char non zero if command is a query 0 if not RR RR EE RR EE RR EE o EE RR EE RE RR EE RR Ck kCk Ck CkCk Ck k k Ck k kCk k k k Ck ck k ck kckckckckckck ck kk ck ke kk ke ke ke x unsigned char isQuery char cmd unsigned char g 0 char query RRR KR RK KR KK KKK KKK KK IR IKK I KK RR EE RX KK KK if the command has a in it use queryInstrument otherwise simply send the command xy Actually we must be a more specific so that
66. EMory DATA PRAM 184 Chapter 4 Downloading and Using Files Downloading Directly into Pattern RAM PRAM Downloading in Block Format NOTE Because there is no parsing block data format downloads are faster than list format downloads SCPI Command to Download Data in Block Format MEMOory DATA PRAM BLOCR lt datablock gt This command downloads the block formatted data directly into pattern RAM Sample Command Line A sample command line MEMory DATA PRAM BLOCk ABC A the number of decimal digits to follow in B a decimal number specifying the number of data bytes in C the binary user file data Example 1 MEMory DATA PRAM BLOCk 1912S407897 1 1 decimal digits to follow 9 9 bytes of data to follow 128407897 the ASCII representation of the data downloaded to the signal generator NOTE Not all binary values can be printed as ASCII characters In fact only ASCII characters corresponding to decimal values 32 to 126 are printable keyboard characters The above example was chosen for simplicity Typically the binary value corresponding to your 8 bit pattern is not printable Therefore the program written to download and upload user files must correctly convert between binary and the ASCII representation of the data sequence The sample data above is meaningless Chapter 4 185 Downloading and Using Files Downloading Directly into Pattern RAM PRAM Modulating and Activating
67. ERP REC ESE LEER GE PEE SA 65 LAN Programming Examples iss 42655 gia germa Rea SE RASA YRERRELERRLERRdIEP ARIA RAS 68 Before Using the EXamples i cuecndustkqueeRDCEE RS CREE ee ae coa bee se PER GE PE RES 68 WA LE TOTAIS iocos Xe po CE HER EREE RERO LI EAE d edd ud 68 Suckers LAN Programming usm iockosssbtauk eer iei eise ied tad odd bodn Ta Sockets LAN Programming Using PERL sss iscicav ere Rete ERES REESE eee seeds 101 Suckers LAN Programming Using Java cuesucs docet pd 9 de EU ER Rd iib dedeqes 103 RS 232 Programming Examples i045 consi ehe RR RARI HOC HR PU R ep RR 106 Before Using the Examples i22 Der ERREUR bb BER ERR EK REX P E ed EP ERR E E 106 Interface Check Using Agilent BASIC cc zoe ds eb add bod b da es 106 Lotestace heck Using VESA and occ es RREXUCKEPY DUREE IE E UB rb pu 107 Quenes sine Agilent BASIC La sd bod gies irs em Es ied odere ed a anb A d dewey 109 Cuenes Dung VISA Mm lesi sit tera da RSS URESARAESSFODSER DESC RE Ear FER 110 3 Programming the Status Register System nn n nnn nnn n nns 113 lag PTT 114 elatus Regista Bit Malas os da bed esque pau to dE Edi de er dieti ip Red e dedg a 117 Accessing Status Register Information sie scars cgeee egies Sele exp bbs aCbYobRGpbdR b Rd 118 Determine Wat to MONUI zbo d Boh j 858 od REGERE Ra DR RR RR E RR RE 118 Decide How fo MOOL es acer s eee held HER e RET P RP RR ERE dn ES TE RE 119 Status Register SCPI COnmablds i t key ene eo Boka ede ses COREE RR RR UR d 12
68. GPIB to download a file directly to the baseband generator volatile memory for play back in the Dual ARB player The program allocates a memory buffer on the PC or workstation of 102400 bytes 100 1024 bytes The actual size of the buffer is limited by the memory on your PC or workstation so the buffer size can be increased or decreased to meet your system limitations While this program is directed at using the GPIB to download a waveform file into volatile memory it can be modified to store files in non volatile memory or for use over the LAN with the following minor changes LAN Replace the GPIB assignment for the instOpenString object with lan lt hostname or IP address gt for the signal generator Non volatile Memory Remove BBGI from the file path assigned to the instDestFile object The program also includes some error checking to alert you when problems arise while trying to download files This includes checking to see if the file exists Chapter 4 163 Downloading and Using Files Downloading ARB Waveform Data Description Send a file in blocks of data to an ESG include lt sicl h gt include lt stdlib h gt include lt stdio h gt include lt string h gt ATTENTION Configure these three lines appropriately for your instrument and use before compiling and running char instOpenString gpib7 19 for LAN replace with lan lt hostname or IP address gt const char localSrcF
69. HP UX 10 20 UNIX using HP cc or gcc cc Aa O o Llanio lanio c gcc Wall O o lanio lanio c Windows 95 using Microsoft Visual C 4 0 Standard Edition Windows NT 3 51 using Microsoft Visual C 4 0 Chapter 2 Programming Examples LAN Programming Examples Be sure to add WSOCK32 LIB to your list of libraries Compile both lanio c and getopt c Consider re naming the files to lanio cpp and getopt cpp Considerations On UNIX systems file I O can be used on network sockets m This makes programming very convenient since routines like getc fgets fscanf and fprintf can be used These routines typically use the lower level read and write calls In the Windows environment file operations such as read write and close cannot be assumed to work correctly when applied to sockets Instead the functions send and recv MUST be used A Support both Win32 and HP UX UNIX environment ifdef _WIN32 Visual C 6 0 will define this define WINSOCK dendif ifndef WINSOCK ifndef HPUX SOURCE define HPUX SOURCE endif endif include lt stdio h gt for fprintf and NULL include lt string h gt for memcpy and memset include lt stdlib h gt for malloc atol include lt errno h gt for strerror E7 Chapter 2 77 Programming Examples LAN Programming Examples ifdef WINSOCK include lt windows h g
70. I Q modulator The waveform data is described using 16 bit I and 16 bit Q integer values in 2 s signed complement format The I and Q data values are interleaved creating a single I Q waveform data file The marker file comprises 8 bit bytes each of which has four marker bits and four unused bits The result is that the I Q file has four times as many bytes as the marker file The 2 byte I integer and 2 byte Q integer values along with a marker byte make up one sample and one point is one pair of I Q values There are five bytes of data for every sample as shown in the following table I Q Data File Structure I 16 bits Qo 16 bits I 16 bits Q 16 bits 2 bytes 2 bytes 2 bytes 2 bytes Marker File Structure 4 bits unused Mo 4 bits 4 bits unused M 4 bits MSB LSB MSB LSB 1 byte 1 byte 1 sample 1 sample Marker File Location MKRI user bbgl markers Chapter 4 NVMKR user markers 153 Downloading and Using Files Downloading ARB Waveform Data Data Requirements and Limitations Data must be in signed 2 s complement binary format Data must be in 2 byte integers Two bytes are needed to express 16 bit waveforms The signal generator accepts the MSB first LSB last Input integers must be between 32768 and 32767 This range is based on the input specifications of the 16 bit DAC used to create the analog voltages for the I Q modulator e 0 0 volts e 32768
71. INT Verify that the remote R annunciator is on Press the Local key PRINT on the front panel to return the signal generator to local control PRINT Chapter 2 31 Programming Examples GPIB Programming Examples 280 290 PRINT Press RUN to start again END Program ends Interface Check Using NI 488 2 and C This example uses the NI 488 2 library to verify that the GPIB connections and interface are functional Launch Microsoft Visual C 6 0 add the required files and enter the following code into your cpp source file The following program example is available on the PSG Documentation CD ROM as niex1 cpp bf if kc kk kk KK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KKK PROGRAM NAME niexl cpp PROGRAM DESCRIPTION This program verifies that the GPIB connections and interface are functional Connect a GPIB cable from the PC GPIB card to the signal generator Enter the following code into the source cpp file and execute the program KAZ KKK KK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK ck ck ck KKK KKK KKK ck ck KKK KKK KKK KKK KKK KKK include stdafx h include lt iostream gt include windows h include Decl 32 h using namespace std int GPIBO 0 Board handle Addr4882 t Address 31 Declares an array of type Addr4882 t int main void 32 Chapter 2
72. MPORTANT Set the signal generator BAUD rate to 9600 for this test J RR RRR RRR KR KKK IKK KK KKK HK IKK I RR EE RAE IKK RR IK KK IK RE EE RR RR oko k kok ok oko kok oko XX RX HK include lt visa h gt include lt stdio h gt include StdAfx h include lt stdlib h gt include lt conio h gt void main int baud 9600 Set baud rate to 9600 printf Manually set the signal generator power level to 0 dBm n printer va 3 printf Press any key to continue n getch printf Nn ViSession defaultRM vi Declares a variable of type ViSession for instrument communication on COM 2 port ViStatus viStatus 0 Opens session to RS 232 device at serial port 2 viStatus viOpenDefaultRM amp defaultRM viStatus viOpen defaultRM ASRL2 INSTR VI NULL VI NULL amp vi 108 Chapter 2 Programming Examples RS 232 Programming Examples if viStatus If operation fails prompt user printf Could not open ViSession n printf Check instruments and connections n printfi Xn exit 0 initialize device viStatus viEnableEvent vi VI EVENT IO COMPLETION VI QUEUE VI NULL viClear vi Sends device clear command Set attributes for the session viSetAttribute vi VI_ATTR_ASRL_BAUD baud viSetAttribute vi VI ATTR ASRL DATA BITS 8 viPrintf vi RST n Resets the signal generator printf The signal generator has been reset n printf Power level should be 135 dBm n
73. NONE 90 OUTPUT 9 IDN Querys the sig gen ID 200 ENTER 9 Str Reads the ID 210 WAIT 2 Waits 2 seconds 220 PRINT ID Str Prints ID to the screen 230 OUTPUT 9 POW AMPL 5 dbm Sets the the power level to 5 dbm 240 OUTPUT 9 POW Querys the power level of the sig gen 250 ENTER 9 Stri1 Reads the queried value 260 PRINT Power Strl Prints the power level to the screen 270 END End the program Queries Using VISA and C This example uses VISA library functions to communicate with the signal generator The program verifies that the RS 232 connections and interface are functional Launch Microsoft Visual C add the required files and enter the following code into your cpp source file The following program example is available on the PSG Documentation CD ROM as rs232ex2 cpp J BR KK KR KK I RR RR RE RR EE RR Kk kk kk RR kok k RE RR Kk kok k Ck Ck kk Kk KC k EE kk Ck ke kk k kk RE RE RX RX k k k k k PROGRAM NAME rs232ex2 cpp PROGRAM DESCRIPTION This code example uses the RS 232 serial interface to control 110 Chapter 2 Programming Examples RS 232 Programming Examples the signal generator Connect the computer to the signal generator using the RS 232 serial cable and enter the following code into the project cpp source file The program queries the signal generator ID string and sets and queries the power level Query results are printed to the screen The d
74. OTE For Agilent I O library version J 01 0100 the Identify devices at run time check box must be unchecked Refer to Figure 1 2 Figure 1 2 Show Devices Form Show Devices x Cancel Devices present on interface GPIBT Add device Remove device Auto Add devices 16 Chapter 1 Getting Started Using LAN Using Sockets LAN Sockets LAN is a method used to communicate with the signal generator over the LAN interface using the Transmission Control Protocol Internet Protocol TCP IP A socket is a fundamental technology used for computer networking and allows applications to communicate using standard mechanisms built into network hardware and operating systems The method accesses a port on the signal generator from which bidirectional communication with a network computer can be established Sockets LAN can be described as an internet address that combines Internet Protocol IP with a device port number and represents a single connection between two pieces of software The socket can be accessed using code libraries packaged with the computer operating system Two common versions of socket libraries are the Berkeley Sockets Library for UNIX systems and Winsock for Microsoft operating systems Your signal generator implements a sockets Applications Programming Interface API that is compatible with Berkeley sockets for UNIX systems and Winsock for Microsoft systems The signal generator is also compatible with other
75. Operstionlis 14 13 12 1110987654321 0 saceband Operation YY V V VV Y Y Y Y Y Y Y v 1 peration Positive 15 14 13 12 1 00 98765 432 1 0 Transition Filter Y v Y Y Y vvv Y v Y B band O ti Negative 145 14 43 12 1110987 654 32 10 Transition Filter Y v v Y v vvv vvv v vv Baseband O ti EventRegister IS 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Baseband Operation Event Enable Register 15 14 13 12 11 10 9 8 7 6 To Operation Status Register Bit 10 ck712c 132 Chapter 3 Programming the Status Register System Status Groups Baseband Operation Condition Register The Baseband Operation Condition Register continuously monitors the hardware and firmware status of the signal generator Condition registers are read only Table 3 6 Baseband Operation Condition Register Bits Bit Description 0 Baseband 1 Busy A 1 in this position indicates the signal generator baseband is active 1 Baseband 1 Communicating A 1 in this bit position indicates that the signal generator baseband generator is handling data I O 2 14 Unused These bits are always set to 0 15 Always 0 Query STATus OPERat ion BASeband CONDition Response The decimal sum of the bits set to 1 Example The decimal value 2 is returned The decimal sum 2 bit 1 Baseband Operation Transition Filters negative and positive The Baseband Operation Transition Filters specify which types of bit state changes in the condition regist
76. P 17 TELNET example 20 UNIX 19 using 17 transition filters See also filters data questionable 137 data questionable calibration 148 data questionable frequency 142 data questionable modulation 145 data questionable power 139 description 126 standard operation 130 133 troubleshooting ARB waveform data downloads 171 ping response errors 15 PRAM downloads 186 RS 232 25 user file downloads 178 user FIR filter downloads 181 Index U UNIX TELNET command 20 user files downloading 174 V viPrintf 11 VISA 6 12 22 include files 29 library 30 scanf 11 viClear 10 viPrintf 11 viTerminate 8 viTerminate 8 VXI 11 16 68 programming 68 with SICL 68 with VISA 71 W waveform data directories 152 waveform downloading using C 163 using HP BASIC for UNIX 168 waveform files composition 172 encryption 172 extracting 173 headers 172 use in other PSGs 173 Index 191 Index 192 Index
77. PRAM where 1 restarts pattern Chapter 4 183 Downloading and Using Files Downloading Directly into Pattern RAM PRAM Downloading in List Format NOTE Because of parsing list data format downloads are significantly slower than block format downloads SCPI Command to Download Data in List Format MEMory DATA PRAM LIST lt uint8 gt lt uint8 gt lt gt This command downloads the list formatted data directly into PRAM The variable uint8 is any of the valid 8 bit unsigned integer values between 0 and 255 as specified by the table on page 183 Note that each value corresponds to a unique byte address in PRAM Sample Command Line For example to burst a FIX4 data pattern of 1100 five times then turn the burst off for 32 data periods assuming a 1 bit symbol modulation format the command is MEMory DATA PRAM LIST 85 21 20 20 21 21 20 20 21 21 20 20 21 21 20 20 21 21 20 20 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 144 21 signifies data 1 burst on 1 20 signifies data 0 burst on 1 16 signifies data unspecified burst off 0 85 enables event trigger signifying the beginning of the data pattern 144 signifies data unspecified burst off 0 pattern repeat on 1 Querying the Waveform Data Use the following SCPI command line to determine whether there is a user defined pattern in the PRAM M
78. Programming Examples GPIB Programming Examples int sig Declares a device descriptor variable sig ibdev 0 19 0 13 1 0 Aquires a device descriptor ibclr sig Sends device clear message to signal generator ibwrt sig RST 4 Places the signal generator into a defined state Print data to the output window cout lt lt The signal generator should now be in REMOTE The remote indicator lt lt endl cout annunciator R should appear on the signal generator display lt lt endl return 0 Interface Check using VISA and C This program uses VISA library functions and the C language to communicate with the signal generator The program verifies that the GPIB connections and interface are functional Launch Microsoft Visual C 6 0 add the required files and enter the following code into your cpp source file The following program example is available on the PSG Documentation CD ROM as visaex1 cpp J BR RK KR KK RR oko k RE kk KC Kk A k k kok k kok RR k kok k RR RR Kk kok k RR EE RR k kok kok kok kk k ko RR kok k ke k k k k k PROGRAM NAME visaexl cpp ff PROGRAM DESCRIPTION This example program verifies that the GPIB connections and and interface are functional Turn signal generator power off then on and then run the progam J RR RRR RK KR KKK HK KR IKK I KK IKK IKK I RR EE RR EE RE IRR RE KR RR RE EE k k kok k oko RR EE RR I AR XX A Fe include lt visa h gt include lt stdio h
79. Programming Guide Agilent Technologies PSG Signal Generators This guide applies to the following signal generator models E8267C PSG Vector Signal Generator E8257C PSG Analog Signal Generator E8247C PSG CW Signal Generator Due to our continuing efforts to improve our products through firmware and hardware revisions signal generator design and operation may vary from descriptions in this guide We recommend that you use the latest revision of this guide to ensure you have up to date product information Compare the print date of this guide see bottom of page with the latest revision which can be downloaded from the following website www agilent com find psg ades Agilent Technologies Manufacturing Part Number E8251 90255 Printed in USA December 2003 Copyright 2002 2003 Agilent Technologies Inc Notice The material contained in this document is provided as is and is subject to being changed without notice in future editions Further to the maximum extent permitted by applicable law Agilent disclaims all warranties either express or implied with regard to this manual and to any of the Agilent products to which it pertains including but not limited to the implied warranties of merchantability and fitness for a particular purpose Agilent shall not be liable for errors or for incidental or consequential damages in connection with the furnishing use or performance of this document or any of the Agilent product
80. Register To Status Byte Register Bit 7 ck702d Chapter 3 129 Programming the Status Register System Status Groups Standard Operation Condition Register The Standard Operation Condition Register continuously monitors the hardware and firmware status of the signal generator condition registers are read only Table 3 5 Standard Operation Condition Register Bits Bit Description 0 I Q Calibrating A 1 in this position indicates an I Q calibration is in process 1 Settling A 1 in this bit position indicates that the signal generator is settling 2 Unused This bit position is set to 0 3 Sweeping A 1 in this bit position indicates that a sweep is in progress 4 Measuring Al in this bit position indicates that a bit error rate test is in progress 5 Waiting for Trigger A 1 in this bit position indicates that the source is in a wait for trigger state When option 300 is enabled a 1 in this bit position indicates that TCH PDCH synchronization is established and waiting for a trigger to start measurements 6 7 8 Unused These bits are always set to 0 9 DCFM DCoM Null in Progress A 1 in this bit position indicates that the signal generator is currently performing a DCFM DC M zero calibration 10 Baseband is Busy A 1 in this bit position indicates that the baseband generator is communicating or processing This is a summary bit See the Baseband Operation Status Gro
81. SG for use in other PSGs Waveform files can only be extracted from the SECUREWAVE directory The SECUREWAVE directory is not an actual directory but behaves more like a portal through which waveform data is packaged with header and marker data and encrypted during file extraction You can use either FTP or SCPI commands to extract the waveform file from the PSG to your computer Table 4 2 shows the command syntax options for both methods Table 4 2 Extraction Method Memory Type Command Syntax Options SCPI volatile memory MMEM DATA user bbg1 securewave filename MMEM DATA SWFM1 filename MMEM DATA filename SWFM 1 SCPI non volatile memory MMEM DATA user securewave filename MMEM DATA SNVWFM filename MMEM DATA filename SNVWFM FTP volatile memory get user bbg 1 securewave filename FTP non volatile memory get user securewave filename Downloading encrypted waveform files to the PSG To download an encrypted file to the PSG you must ensure that the file is loaded into the PSG s SECUREWAVE directory where the file is decrypted and unpackaged into its header information waveform data and marker data You can use either FTP or SCPI commands to download encrypted waveform files to the PSG Table 4 3 shows the command syntax options for both methods Table 4 3 Download Method Memory Type Command Syntax Options SCPI volatile memory MMEM DATA user bbg1 securewave filename
82. STEP n Sets sig gen LIST type to step viPrintf vi FREO STAR 500 MHz n Sets start frequency viPrintf vi FREQ STOP 800 MHz n Sets stop frequency viPrintf vi SWE POIN 10 n Sets number of steps 30 mHz step viPrintf vi SWE DWEL 5 S n Sets dwell time to 500 ms step viPrintf vi POW AMPL 5 dBm n Sets the power level for 5 dBm viPrintf vi OUTP STAT ON n Turns RF output on viPrintf vi INIT CONT ONXn Begins the step sweep operation Print user information printf The signal generator is in step sweep mode The frequency range is n printf 500 to 800 mHz There is a 5 sec dwell time at each 30 mHz step n printf Anty Prints a carriage return line feed viPrintf vi OUTP STAT OFF n Turns the RF output off printf Press the front panel Local key to return the n printf signal generoator to manual operation n Closes the sessions print ltiat s viClose vi viClose defaultRM Saving and Recalling States Using VISA and C In this example instrument settings are saved in the signal generator s save register These settings can then be recalled separately either from the keyboard or from the signal generator s front panel Launch Microsoft 52 Chapter 2 Programming Examples GPIB Programming Examples Visual C 6 0 add the required files and enter the following code into your cpp source file The following program example is availabl
83. Stionable MODulation EVENt Data Questionable M odulation Event Enable Register The Data Questionable Modulation Event Enable Register lets you choose which bits in the Data Questionable Modulation Event Register set the summary bit bit 7 of the Data Questionable Condition Register to 1 Command STATus QUEStionable MODulation ENABle value command where value is the sum of the decimal values of the bits you want to enable Example Enable bit 9 and bit 3 so that whenever either of those bits is set to 1 the Data Questionable Modulation summary bit of the Data Questionable Condition Register is set to 1 send the command STAT QUES MOD ENAB 520 512 8 Query STATus QUEStionable MODulation ENABle Response Decimal value of the sum of the bits previously enabled with the STATus QUEStionable MODulation ENABle value command 146 Chapter 3 Programming the Status Register System Status Groups Data Questionable Calibration Status Group The Data Questionable Calibration Status Group is used to determine the specific event that set bit 8 in the Data Questionable Condition Register This group consists of the Data Questionable Calibration Condition Register the Data Questionable Calibration Transition Filters negative and positive the Data Questionable Calibration Event Register and the Data Questionable Calibration Event Enable Register DCFM DC M Zero Failure I Q Calibra
84. VISA C C Visual ISA EISA 750 Built in 82341C for 95 98 NT SICL Basic Agilent 16 bit ISA bus 2000 VEE Agilent computers Basic for Windows Agilent Windows VISA C C Visual ISA EISA 750 Built in 82341D 95 SICL Basic Agilent 16 bit Plug amp Play VEE Agilent for PC Basic for Windows J ava is a U S trademark of Sun Microsystems Inc 4 Chapter 1 Getting Started Using GPIB Table 1 1 Agilent GPIB Interface Card for PC Based Systems Interface Operating 10 Library Languages Backplane B Max IO Buffering Card System US kB sec Agilent Windows VISA C C Visual PCI 32 bit 750 Built in 82350A for 95 98 NT SICL Basic Agilent PCI bus 2000 VEE Agilent computers Basic for Windows Windows 95 98 NT and 2000 are registered trademarks of M icrosoft Corporation Table 1 2 NI GPIB Interface Card for PC Based Systems Interface Operating IO Library Languages Backplane B Max lO Card System US National Windows VISA C C PCI 32 bit 1 5 MB s Instrument s 95 98 2000 NI 488 2 Visual BASIC PCI GPIB ME NT LabView National Windows VISA C C PCI 32 bit 1 5 MB s Instrument s NT NI 488 2 Visual BASIC PCI GPIB LabView NI 488 2 is a trademark of National Instruments Corporation Table 1 3 Agilent GPIB Interface Card for HP UX Workstations Interface Operating 10 Library Languages Backplane B Max I0 Buff
85. a h gt include StdAfx h include lt iostream gt include lt conio h gt void main ViSession defaultRM vi Declares a variables of type ViSession for instrument communication ViStatus viStatus 0 Declares a variable of type ViStatus for GPIB verifications int num 0 Declares a variable for switch statements char rdBuffer 256 0 Declare a variable for response data viStatus viOpenDefaultRM amp defaultRM Initialize VISA session 56 Chapter 2 Programming Examples GPIB Programming Examples Open session to GPIB device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI NULL VI NULL amp vi if viStatus If problems then prompt user printf Could not open ViSession Mn printf Check instruments and connections n printer n exit 0 Prince n viClear vi Clears the signal generator Prints user information printf Programming example to demonstrate reading the signal generator s Status Byte n preintfi Xm ys printf Manually set up the sig gen for an unleveled output condition n printf Set signal generator output amplitude to 20 dBm n printf Set frequency to maximum value n printf Turn On signal generator s RF Output n printf Check signal generator s display for the UNLEVEL annuniator Mn orintE na printf Press Enter when ready n printf TnT getch Waits for keyboard user
86. active controller Chapter 1 7 Getting Started Using GPIB GPIB Function Statements Function statements are the basis for GPIB programming and instrument control These function statements combined with SCPI provide management and data communication for the GPIB interface and the signal generator This section describes functions used by different IO libraries Refer to the NI 488 2 Function Reference Manual for Windows Agilent Standard Instrument Control Library reference manual and Microsoft Visual C 6 0 documentation for more information Abort Function The Agilent BASIC function ABORT and the other listed IO library functions terminate listener talker activity on the GPIB and prepare the signal generator to receive a new command from the computer Typically this is an initialization command used to place the GPIB in a known starting condition Agilent BASIC VISA NI 488 2 Agilent SICL 10 ABORT 7 viTerminate parameter list ibstop int ud iabort id Agilent BASIC The ABORT function stops all GPIB activity VISA Library In VISA the viTerminate command requests a VISA session to terminate normal execution of an asynchronous operation The parameter list describes the session and job id NI 488 2 Library The NI 488 2 library function aborts any asynchronous read write or command operation that is in progress The parameter ud is the interface or device descriptor SICL The Agilent SICL functi
87. al generator to perform an instrument reset The SCPI command RST places the signal generator into a pre defined state and the remote annunciator R appears on the front panel display The following program example is available on the PSG Documentation CD ROM as basicexl txt 10 20 30 40 50 60 70 80 90 00 10 20 30 40 50 60 70 80 220 230 240 250 270 PKK KKK KKK KKKK KKK KK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KKK KK KK KKK KKK KK RR ko kk ck ck ko ko XX PROGRAM NAME basicexl txt PROGRAM DESCRIPTION This program verifies that the GPIB connections and interface are functional Connect a controller to the signal generator using a GPIB cable CLEAR and RESET the controller and type in the following commands and then RUN the program o ck ok ok kk kk Ck Ck kk Ck Ck X AX Ck ck kk Ck ke kk Ce kk kk Ce kk kk X X kk X AX kk X AX kk ke kk kk kk ko ko ko ko ko ko ko kc ko ko ko ko ko k ko KKK Sig gen 719 Declares a variable to hold the signal generator s address LOCAL Sig gen Places the signal generator into Local mode CLEAR Sig gen Clears any pending data I O and resets the parser REMOTE 719 Puts the signal generator into remote mode CLEAR SCREEN Clears the controllers display REMOTE 719 OUTPUT Sig gen RST Places the signal generator into a defined state PRINT The signal generator should now be in REMOTE PRINT PR
88. am Generating a CW Signal Using J ava The following program example is available on the PSG Documentation CD ROM as javaex txt J RR RRR kok k KR KKK IKK HK KKK RR EE o KK IK EE RR EE RE RR IK IR kok k kok k I HK PROGRAM NAME javaex txt Sample java program to talk to the signal generator via SCPI over sockets This program requires Java version 1 1 or later Save this code as ScpiSockTest java Compile by typing javac ScpiSockTest java Run by typing java ScpiSockTest The signal generator is set for 1 GHz and queried for its id string JKR RK KKK IK KK I KK kk kok k kok kok oko oko KR IRR IR IR IRR IR k k k k k k k k k kk k I k k k ke ke ke Chapter 2 103 Programming Examples LAN Programming Examples import java io import java net class ScpiSockTest public static void main String args String instrumentName xxxxx Put your hostname here try Socket t new Socket instrumentName 7777 Connect to instrument Setup read write mechanism BufferedWriter out new BufferedWriter new OutputStreamWriter t getOutputStream BufferedReader in new BufferedReader new InputStreamReader t getInputStream System out println Setting frequency to 1 GHz out write freq 1GHz n Sets frequency out flush System out println Waiting for source to settle out write ope n Waits for completion out flush String opcResponse in readLine if
89. and line to query user file data from a binary memory MMEM DATA file name The output format is the same as the input format Selecting Dow nloaded User Files as the Transmitted Data Use the following steps to select the desired user file from the catalog of user files as a continuous stream of unframed data for a custom modulation Via the front panel 1 For custom modulation press Mode gt Custom gt Real Time I Q Baseband gt Data gt User File and highlight the desired file in the catalog SOURCe RADio CUSTom DATA BIT lt file_name gt 2 Press Select File gt Custom Off On to On SOURce RADio CUSTom STATe On NOTE To select a user file from a binary directory send the same commands shown in the above examples without BIT preceding the file name For example SOURce RADio CUSTom DATA lt file name gt 3 Modulate and activate the carrier a Set the carrier frequency b Set the carrier amplitude c Turn on modulation d Turn on the RF output Troubleshooting User File Download Problems NOTE Review Data Requirements and Limitations on page 175 178 Chapter 4 Downloading and Using Files Downloading FIR Filter Coefficients Downloading FIR Filter Coefficients The signal generator accepts finite impulse response FIR filter coefficient downloads After downloading the coefficients these user defined FIR filter coefficient values can be selected as the filtering mechanism f
90. anf vi d amp lngDone Waits for setup to complete Print user infromation 54 Chapter 2 Programming Examples GPIB Programming Examples printf The instrument is now in it s Reset operating state Press the n printf Enter key to return the signal generator to the Register 41 state n printf Nn Prints new line character getch Waits for user input lngDone 0 Reset the operation complete flag viPrintf vi ROL la Recalls stored register 1 state WiPrinti wi OPC n s Checks for operation complete while l1ngDone viScanf vi d amp lngDone Waits for setup to complete Print user information printf The signal generator has been returned to it s Register 1 state n printf Press Enter to continue n printf Nn Prints new line character getch Waits for user input lngDone 0 Reset the operation complete flag viPrintf vi RSTXn Resets the signal generator viPrintfi ivi OPOCTYA4n Checks for operation complete while lngDone viScanf vi d amp lngDone Waits for setup to complete Print user information printf Press Local on instrument front panel to return to manual mode n printf Xn Prints new line character Close the sessions viClose vi viClose defaultRM Reading the Data Questionable Status Register Using VISA and C In this example the signal generator s data questionable status regi
91. as Te Service Request Enable Register ck721a Chapter 3 123 Programming the Status Register System Status Byte Group Status Byte Register Table 3 3 Status Byte Register Bits Bit Description 0 1 Unused These bits are always set to 0 2 Error Event Queue Summary Bit A 1 in this bit position indicates that the SCPI error queue is not empty the SCPI error queue contains at least one error message Data Questionable Status Summary Bit A 1 in this bit position indicates that the Data Questionable summary bit has been set The Data Questionable Event Register can then be read to determine the specific condition that caused this bit to be set Message Available A 1 in this bit position indicates that the signal generator has data ready in the output queue There are no lower status groups that provide input to this bit Standard Event Status Summary Bit A 1 in this bit position indicates that the Standard Event summary bit has been set The Standard Event Status Register can then be read to determine the specific event that caused this bit to be set Request Service RQS Summary Bit A 1 in this bit position indicates that the signal generator has at least one reason to require service This bit is also called the Master Summary Status bit MSS The individual bits in the Status Byte are individually ANDed with their corresponding service request enable register then each individual bit value is ORe
92. aseband 1 Unlocked A 1 in this bit indicates that the baseband 1 generator is unlocked 4 Unused This bit is always set to 0 5 Sampler Loop Unlocked A 1 in this bit indicates that the sampler loop is unlocked 6 YO Loop Unlocked A 1 in this bit indicates that the YO loop is unlocked 7 14 Unused These bits are always set to 0 15 Always 0 Query STATus QUEStionable FREQuency CONDition Response The decimal sum of the bits set to 1 Data Questionable Frequency Transition Filters negative and positive Specifies which types of bit state changes in the condition register set corresponding bits in the event register Changes can be positive 0 to 1 or negative 1 to 0 142 Commands Queries S S where value is the sum of the decimal v S S A us QUEStionable FRI A us QUEStionable FRI A us QUEStionable FRI A us QUEStionable FRI EQuency NI EOuency P1 EQuency NI EQuency P1 Ransition value negative transition or Ransition value positive transition alues of the bits you want to enable Ransition Ransition Chapter 3 Programming the Status Register System Status Groups Data Questionable Frequency Event Register Latches transition events from the condition register as specified by the transition filters Event registers are destructive read only reading data from an event register clears the content of that register
93. ation EVENt Standard Operation Event Enable Register The Standard Operation Event Enable Register lets you choose which bits in the Standard Operation Event Register set the summary bit bit 7 of the Status Byte Register to 1 Command Example Query Response Chapter 3 STATus OPERation ENABle lt value gt where value is the sum of the decimal values of the bits you want to enable Enable bit 9 and bit 3 so that whenever either of those bits is set to 1 the Standard Operation Status summary bit of the Status Byte Register is set to 1 send the command STAT OPER STATus OPERation l ENAB 520 512 8 ENABle Decimal value of the sum of the bits previously enabled with the STATus OP ERation ENABle lt value gt command 131 Programming the Status Register System Status Groups Baseband Operation Status Group The Baseband Operation Status Group is used to determine the specific event that set bit 10 in the Standard Operation Status Group This group consists of the Baseband Operation Condition Register the Baseband Operation Transition Filters negative and positive the Baseband Operation Event Register and the Baseband Operation Event Enable Register Baseband 1 Busy Baseband 1 Communicating Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Always Zero 0 Baseband
94. bit of the Service Request Enable Register is also set to 1 e The signal generator does not have a service request pending A service request is considered to be pending between the time the signal generator s SRQ process is initiated and the time the controller reads the status byte register If a program enables the controller to detect and respond to service requests it should instruct the controller to perform a serial poll when SRQ is true Each device on the bus returns the contents of its status byte register in response to this poll The device whose request service summary bit RQS bit is set to 1 is the 120 Chapter 3 Programming the Status Register System Accessing Status Register Information device that requested service NOTE When you read the signal generator s Status Byte Register with a serial poll the RQS bit is reset to 0 Other bits in the register are not affected If the status register is configured to SRQ on end of sweep or measurement and the mode set to continuous restarting the measurement INIT command can cause the measuring bit to pulse low This causes an SRQ when you have not actually reached the end of sweep or measurement condition To avoid this do the following 1 Send the command INITiate CONTinuous OFF 2 Set enable the status registers 3 Restart the measurement send INIT Status Register SCPI Commands Most monitoring of signal generator conditions is done at the highest level
95. ble POWer EVENt Chapter 3 139 Programming the Status Register System Status Groups Data Questionable Power Event Enable Register The Data Questionable Power Event Enable Register lets you choose which bits in the Data Questionable Power Event Register set the summary bit bit 3 of the Data Questionable Condition Register to 1 Command STATus QUEStionable POWer ENABle value command where value is the sum of the decimal values of the bits you want to enable Example Enable bit 9 and bit 3 so that whenever either of those bits is set to 1 the Data Questionable Power summary bit of the Data Questionable Condition Register is set to 1 send the command STAT QUES POW ENAB 520 512 8 Query STATus QUEStionable POWer ENABle Response Decimal value of the sum of the bits previously enabled with the STATus QUEStionable POWer ENABle value command 140 Chapter 3 Programming the Status Register System Status Groups Data Questionable Frequency Status Group The Data Questionable Frequency Status Group is used to determine the specific event that set bit 5 in the Data Questionable Condition Register This group consists of the Data Questionable Frequency Condition Register the Data Questionable Frequency Transition Filters negative and positive the Data Questionable Frequency Event Register and the Data Questionable Frequency Event Enable Register Synthesizer Unlocked 10 MH
96. c files to your home UNIX directory For example users mydir 2 Atthe UNIX prompt in your home directory type cc Aa O o lanio lanio c 3 Atthe UNIX prompt in your home directory type 1anio xxxxx IDN where xxxxx is the hostname for the signal generator Use this same format to output SCPI commands to the signal generator Chapter 2 73 Programming Examples LAN Programming Examples The int mainl function will output a sequence of commands in a program format If you want to run a program using a sequence of commands then perform the following 1 Rename the lanio c int mainl to int main andthe original int main to int mainl 2 Inthe main openSocket function change the your hostname here string to the hostname of the signal generator you want to control 3 Resave the lanio c program 4 At the UNIX prompt type cc Aa O o lanio lanio c 5 At the UNIX prompt type lanio The program will run and output a sequence of SCPI commands to the signal generator The UNIX display will show a display similar to the following unix machine users mydir lanio ID Agilent Technologies E8254A US00000001 C 01 00 Frequency 2 5000000000000E 09 Power Level 5 00000000E 000 Sockets on Windows In Windows the routines send and recv must be used since fread and fwrite may not work on sockets The following steps outline the process for running the interactive program in the M
97. check the command syntax before continuing with troubleshooting If the syntax is correct resolve the error messages using your network documentation or by consulting your network administrator If an unknown host error message appears try using the IP address instead of the hostname Also verify that the host name and IP address for the signal generator have been registered by your IT administrator Check that the hostname and IP address are correctly entered in the node names database To do this enter the nslookup lt hostname gt command from the command prompt No Response If there is no response from a ping no packets were received Check that the typed address or hostname matches the IP address or hostname assigned to the signal generator in the System Utility gt GPIB RS 232 LAN gt LAN Setup menu Ping each node along the route between your workstation and the signal generator starting with your workstation If a node doesn t respond contact your IT administrator If the signal generator still does not respond to ping you should suspect a hardware problem Intermittent Response If you received 1 to 8 packets back there maybe a problem with the network In networks with switches and bridges the first few pings may be lost until the these devices learn the location of hosts Also because the number of packets received depends on your network traffic and integrity the number might be different for
98. ckets in UNIX oko RK kok ok KKK IK IK KKK IK EE RE RR EE k k EE RE k k I EE RE k RR XX RR XX ke FILE instFile instFile fdopen sock r if instFile NULL 84 Chapter 2 Programming Examples LAN Programming Examples fprintf stderr Unable to create FILE structure s n strerror errno exit 2 return fgets result maxLength instFile endif RRR KK KKK KKK IKK IKK IKK I RR EE RR I KK IKK RE RE IRR RE EE RE RR k kok k kok k EX X ke gt Function queryInstrument Description send a SCPI command to the instrument return a response Parameters FILE file pointer associated with TCP IP socket const char command SCPI command string char result where to put the result size_t maxLength maximum size of result array in bytes SReturn long The number of bytes in result buffer SErrors returns 0 if anything goes wrong EOKCKCkCKCkCkC Ck k oko kok k k oko kk Fe kok k k oko k k Fe kok k kok kok kok kk kok k kk k kk kk k ke ek ke ke long gueryInstrument SOCKET sock const char command char result size t maxLength long ch Chapter 2 85 Programming Examples LAN Programming Examples char tmp_buf 8 long resultBytes 0 int command_err int count RRR KK KK KKK KK KR RR IK KK RR EE RR IK IR IK k k I k k k ee Send command to signal generator KR KK EE RR EE RE
99. d FM signalMn printf Press any key to continue n print ltinti s getch printf n viPrintE wi RSTin Resets the signal generator viPrintf vi FM SOUR EXT2 n Sets EXT 2 source for FM viPrintf vi FM EXT2 COUP AC n Sets FM path 2 coupling to AC viPrintf vi FM DEV 20 kHz n Sets FM path 2 deviation to 20 kHz viPrintf vi FREQ 700 MHz n Sets carrier frequency to 700 MHz viPrintf vi POW AMPL 2 5 dBm n Sets the power level to 2 5 dBm viPrintf vi FM STAT ON n Turns on frequency modulation viPrintf vi OUTP STAT ON n Turns on RF output Print user information printf Power level 2 5 dBm n printf FM state onn printf RF output z onn printf Carrier Frequency 700 MHZ n printf Deviation 20 kHZ n printf EXT2 and AC coupling are selected Mn printfi Xm s Prints a carrage return Close the sessions viClose vi viClose defaultRM 48 Chapter 2 Programming Examples GPIB Programming Examples Generating an Internal AC Coupled FM Signal Using VISA and C In this example the VISA library is used to generate an ac coupled internal FM signal at a carrier frequency of 900 MHz and a power level of 15 dBm The FM rate will be 5 kHz and the peak deviation will be 100 kHz Launch Microsoft Visual C 6 0 add the required files and enter the following code into your cpp source file The following program example is availab
100. d and input to this bit Standard Operation Status Summary Bit A 1 in this bit position indicates that the Standard Operation Status Group s summary bit has been set The Standard Operation Event Register can then be read to determine the specific condition that caused this bit to be set 124 Query STB Response The decimal sum of the bits set to 1 including the master summary status bit MSS bit 6 Example The decimal value 136 is returned when the MSS bit is set low 0 Decimal sum 128 bit 7 8 bit 3 The decimal value 200 is returned when the MSS bit is set high 1 Decimal sum 128 bit 7 8 bit 3 64 MSS bit Chapter 3 Programming the Status Register System Status Byte Group Service Request Enable Register The Service Request Enable Register lets you choose which bits in the Status Byte Register trigger a service request SRE lt data gt data is the sum of the decimal values of the bits you want to enable except bit 6 Bit 6 cannot be enabled on this register Refer to Figure 3 1 on page 115 or Figure 3 2 on page 116 Example Enable bits 7 and 5 to trigger a service request when either corresponding status group register summary bit sets to 1 send the command SRE 160 128 32 Query SRE Response The decimal value of the sum of the bits previously enabled with the SRE lt data gt command Chapter 3 125 Programming the Status Register System Status Gro
101. display screen will be displayed 4 Click on the Connect menu then select Remote System A connection form Figure 1 3 is displayed Figure 1 3 Connect Form Host Name Instrument name Port 5023 TermType III Cancel 5 Enter the hostname port number and TermType then click Connect e Host Name IP address or hostname e Port 5023 Term Type vt100 6 Atthe SCPI prompt enter SCPI commands Refer to Figure 1 4 on page 19 7 To signal device clear press Ctrl C on your keyboard 8 Select Exit from the Connect menu and type exit at the command prompt to end the TELNET session Using TELNET On a PC With a Host Port Setting Menu GUI 1 On your PC click Start gt Run Type telnet then click the Ok button The TELNET connection screen will be displayed Click on the Connect menu then select Remote System A connection form is displayed See Figure 1 3 Po 9 BO Enter the hostname port number and TermType then click Connect e Host Name signal generator s IP address or hostname e Port 5023 Term Type vt100 5 Atthe SCPI prompt enter SCPI commands Refer to Figure 1 4 on page 19 6 To signal device clear press Ctrl C 7 Select Exit from the Connect menu to end the TELNET session 18 Chapter 1 Getting Started Using LAN Figure 1 4 TELNET Window A Telnet tpvlp1 BBE Connect Edt Iemma Hep Agilent Technologies E8254A SN US 00000904 Firmware Mar 28 2001 11 23 18 Hostname 00
102. dulation 2 Overmod A 1 in this bit indicates that the External 2 input ac coupling on is greater than 1 03 volts 4 Modulation Uncalibrated A 1 in this bit indicates that modulation is uncalibrated 5 14 Unused These bits are always set to 0 15 Always 0 Query STATus QUEStionable MODulation CONDition Response The decimal sum of the bits that are set to 1 Data Questionable M odulation Transition Filters negative and positive The Data Questionable Modulation Transition Filters specify which type of bit state changes in the condition register set corresponding bits in the event register Changes can be positive 0 to 1 or negative 1 to 0 Commands STATus QUEStionable MODulation NTRansition value negative transition or STATus QUEStionable MODulation PTRansition value positive transition where value is the sum of the decimal values of the bits you want to enable Queries STATus QUEStionable MODulation NTRansition STATus QUEStionable MODulation PTRansition Chapter 3 145 Programming the Status Register System Status Groups Data Questionable M odulation Event Register The Data Questionable Modulation Event Register latches transition events from the condition register as specified by the transition filters Event registers are destructive read only reading data from an event register clears the contents of that register Query STATus QUE
103. e xxxxx Put your instrument s hostname here char instNameBuf 256 Variable to hold instrument name char buf 256 Variable for id string ionerror I ERROR EXIT Register SICL error handler Open SICL instrument handle using VXI 11 protocol sprintf instNameBuf lan s instO0 instrumentName id iopen instNameBuf Open instrument session Chapter 2 69 Programming Examples LAN Programming Examples itimeout id 1000 Set 1 second timeout for operations printf Setting frequency to 1 Ghz n iprintf id freq 1 GHz n Set frequency to 1 GHz printf Waiting for source to settle n iprintf id opc n Query for operation complete iscanf id d amp opcResponse Operation complete flag if opcResponse 1 If operation fails prompt user printf Bad response to OPC n iclose id exit 1 iprintf id FREQ n Query the frequency iscanf id t amp buf Read the signal generator frequency printf n Print the frequency to the display printf Frequency of signal generator is s n buf ipromptf id IDN Xn St buf i Query for id string printf Instrument ID s n buf Print id string to display iclose id Close the session return 0 70 Chapter 2 Programming Examples LAN Programming Examples VXI 11 Programming Using VISA in C The following program uses the VXI 11 protocol and the VISA library to control th
104. e B x ID Agilent Technologies E8254A US00000001 C 01 00 s Frequency 2 5000000000000E 09 Power Level 5 00000000E 000 Press any key to continue_ ce914a Setting Parameters and Sending Queries Using Sockets and C The following programming examples are available on the PSG Documentation CD ROM as lanio c and getopt c ROR KKK KKK KK kk Ck kk RE Kk Ck KK Ck Ck Kk EE KK IKK Kk RE k oko k oko kk Kk Ck Ck RR k ke kk ck RR XX A SHeader lanio c 04 24 01 SRevision 1 1 Date 04 24 01 PROGRAM NAME lanio c Chapter 2 75 Programming Examples LAN Programming Examples SDescription Functions to talk to an Agilent signal generator via TCP IP Uses command line arguments A TCP IP connection to port 7777 is established and the resultant file descriptor is used to talk to the instrument using regular socket I O mechanisms Examples Query the signal generator frequency lanio xx xxx xx x FREQ Query the signal generator power level lanio xx xxx xx x POW Check for errors gets one error lanio xx xxx xx x syst err Send a list of commands from a file and number them cat scpi cmds lanio n xx xxx xx x xk ck kk kk kk e A A A AX AX AX X A ck ck ck ck ck ck ck ck ck ck X ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck ck X ck ck kk ck ck ck ck ck ck kk ck ko 76 This program compiles and runs under
105. e on the PSG Documentation CD ROM as visaex8 cpp J RR RRR RRR KR KKK IK KR KK KKK IKK IKK I RR EE RR EE RE IK IK KK RR I kok k k kok k oko kok ok oko kok IO I A Fe PROGRAM FILE NAME visaex8 cpp PROGRAM DESCRIPTION In this example instrument settings are saved in the signal generator s registers and then recalled Instrument settings can be recalled from the keyboard or when the signal generator is put into Local control from the front panel This program will initialize the signal generator for an instrument state store the state to register 1 An RST command will reset the signal generator and a RCL command will return it to the stored state Following this remote operation the user will be instructed to place the signal generator in Local mode J RR RK KKK IK KK IKK IKK I kok oko k kok k oko k kok k oko kok kok k k kok k kok kok kok k k RR EE k k EE k kok kok k k k kok kok k k k k He include lt visa h gt include StdAfx h include lt iostream gt include lt conio h gt void main ViSession defaultRM vi Declares variables of type ViSession for instrument communication ViStatus viStatus 0 Declares a variable of type ViStatus for GPIB verifications long lngDone 0 Operation complete flag viStatus viOpenDefaultRM amp defaultRM Initialize VISA session Open session to gpib device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI NULL
106. e signal generator The signal generator is set to a 1 GHz CW frequency and queried for its ID string Before running this code you must set up the interface using the Agilent IO Libraries IO Config utility This example is available on the PSG Documentation CD ROM as vxivisa cpp J RR RK KR KK IK KK I KK IKK I KK RR k oko RR RR EE RE IRR RR IIR IRR RR IIR k k k IRA k k k k kk k k RX k k XX k k PROGRAM FILE NAME vxivisa cpp Sample test program using the VISA libraries and the VXI 11 protocol NOTE You must have the Agilent Libraries installed on your computer to run this program PROGRAM DESCRIPTION This example uses the VXI 11 protocol and VISA to query the signal generator for its ID string The ID string is then printed to the Screen Next the signal generator is set for a 5 dBm power level and then queried for the power level The power level is printed to the screen IMPORTANT Set up the LAN Client using the IO Config utility J RR RRR kok ok KR KKK Kk KK kk KK KK IKK IKK I KK IK I KK IRR RE EE RE IRR Kk Ck KC K kk Kk Ck kk IR ko kk RX ke kk ke ke include visa h include lt stdio h gt include StdAfx h include lt stdlib h gt include lt conio h gt define MAX_COUNT 200 int main void Chapter 2 71 Programming Examples LAN Programming Examples ViStatus status Declares a type ViStatus variable ViSession defaultRM instr Declares a ty
107. ed from a program However if this method is used executable programs will not be portable to other hardware platforms For example a program using SICL functions will not run on a computer with NI libraries PCI GPIB interface card NI 488 2 can be used without the VISA overlay The NI 488 2 functions can be called from a program However if this method is used executable programs will not be portable to other hardware platforms For example a program using NI 488 2 functions will not run on a computer with Agilent SICL Agilent GPIB interface card 3 Setting Up the GPIB Interface 1 Press Utility gt GPIB RS 232 gt GPIB Address 2 Use the numeric keypad the arrow keys or rotate the front panel knob to set the desired address The signal generator s GPIB address is set to 19 at the factory The acceptable range of addresses is 0 through 30 Once initialized the state of the GPIB address is not affected by a signal generator preset or by a power cycle Other instruments on the GPIB cannot use the same address as the signal generator NI VISA is a registered trademark of National Instruments Corporation Chapter 1 Getting Started Using GPIB 3 Press Enter 4 Connect a GPIB interface cable between the signal generator and the computer Refer to Table 1 4 for cable part numbers Table 1 4 Agilent GPIB Cables Model 10833A 10833B 10833C 10833D 10833F 10833G Length 1 meter 2 meters 4 meters 5 meter 6 met
108. efault attributes e g 9600 baud parity 8 data bits 1 stop bit are used These attributes can be changed using VISA functions IMPORTANT Set the signal generator BAUD rate to 9600 for this test J RR RK kok ok KR KKK I KK KK KK I KK IKK IKK IKK IKK A IKK IR IA IRR RR RI k k k k k k I k k k A include lt visa h gt include lt stdio h gt include StdAfx h include lt stdlib h gt include lt conio h gt define MAX_COUNT 200 int main void ViStatusstatus Declares a type ViStatus variable ViSessiondefaultRM instr Declares type ViSession variables ViUInt32retCount Return count for string I O ViCharbuffer MAX COUNT Buffer for string I O status viOpenDefaultRM amp defaultRM Initializes the system Open communication with Serial Port 2 status viOpen defaultRM ASRL2 INSTR VI NULL VI NULL amp instr Chapter 2 111 Programming Examples RS 232 Programming Examples if status If problems then prompt user printf Could not open ViSession n printf Check instruments and connections M n printfi Xm s exit 0 Set timeout for 5 seconds viSetAttribute instr VI ATTR TMO VALUE 5000 Asks for sig gen ID string status viWrite instr ViBuf IDN n 6 amp retCount Reads the sig gen response status viRead instr ViBuf buffer MAX COUNT amp retCount buffer retCount 0 Indicates the end of the string printf Signal G
109. egister system and hierarchy The status register system uses IEEE 488 2 commands those beginning with to access the higher level summary registers Lower level registers can be accessed using STATus SCPI commands 114 Chapter 3 Figure 3 1 R P P Tripped Unleveled Unused Unused Unused cla Unused Unused p Unused eis Unused Unused Tre Unused jal ndi Unused Unused Unused Unused Always Zero 0 Synth Unlocked 10 MHz Ref Unlocked 1GHz Ref Unlocked Baseband 1 Unlocked Unused Sampler Loop Unlocked YO Loop Unlocked Unused Unused Unused Unused Unused Unused Unused Unused Always Zero 0 Trans Filter Trans Filter Mod 1 Undermod Mod 1 Overmod Mod 2 Undermod Mod 2 Overmod Modulation Uncalibrated 5 5 Unused rl Unused alo Unused als Unused El Unused O Unused Unused Unused Unused Unused Always Zero 0 Data Quest Calibration Status Group DCFM DCIM Zero Failure VQCalibration Failure Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Always Zero 0 Trans Filter Chapter 3 vent Register Event Register Event Register Event Enable Reg Event Register Event Enable Reg nable Reg ven vent Enable Reg Programming the Status Register System Overview The Overall Status Byte Register System 1 of 2 Data Questionable Power Status Group To
110. enerator ID Prints header for ID printf buffer Prints the ID string to the screen printf n Prints carriage return Flush the read buffer Sets sig gen power to 5dbm status viWrite instr ViBuf POW AMPL 5dbm n 15 amp retCount Querys the sig gen for power level status viWrite instr ViBuf POW n 5 amp retCount Read the power level status viRead instr ViBuf buffer MAX COUNT amp retCount buffer retCount 0 Indicates the end of the string printf Power level Prints header to the screen printf buffer Prints the queried power level printf Xn s status viClose instr Close down the system status viClose defaultRM return 0 112 Chapter 2 3 Programming the Status Register System This chapter provides the following major sections Overview on page 114 Status Register Bit Values on page 117 Accessing Status Register Information on page 118 Status Byte Group on page 123 Status Groups on page 126 113 Programming the Status Register System Overview Overview During remote operation you may need to monitor the status of the signal generator for error conditions or status changes The signal generator s error queue can be read with the SCPI query SYSTem ERRor Refer to ERRor NEXT in the SCPI command reference guide to see if any errors have occurred An alternative method uses the signal generator s status reg
111. enter the following command on the command line telnet myInstrument 5023 When you connect to the signal generator the UNIX window will display a welcome message and a SCPI command prompt The instrument is now ready to accept your SCPI commands As you type SCPI commands query results appear on the next line When you are done break the TELNET connection using an escape character For example Ctrl where the control key and the are pressed at the same time The following example shows TELNET commands telnet myinstrument 5023 Trying s Connected to signal generator Escape character is Agilent Technologies E8254A SN US00000001 Firmware Hostname your instrument IP XXX XX XXX XXX SCPI Using FTP FTP allows users to transfer files between the signal generator and any computer connected to the LAN For example you can use FTP to download instrument screen images to a computer When logged onto the signal generator with the FTP command the signal generator s file structure can be accessed Figure 1 5 shows the FTP interface and lists the directories in the signal generator s user level directory NOTE File access is limited to the signal generator s user directory 20 Chapter 1 Getting Started Using LAN Figure 1 5 FTP Screen pen Command Prompt ftp 000 000 00 000 lt C gt Copyrights 1985 1996 Microsoft Corp C gt ftp 000 000 00 000 connected to 000 000 000 000 220 Agilent Technologie
112. er set corresponding bits in the event register Changes can be positive 0 to 1 or negative 1 to 0 Commands STATus OPERation BASeband NTRansition value negative transition or STATus OPERation BASeband PTRansition value positive transition where value is the sum of the decimal values of the bits you want to enable Queries STATus OPERation BASeband NTRansition STATus OPERation BASeband PTRansition Baseband Operation Event Register The Baseband Operation Event Register latches transition events from the condition register as specified by the transition filters Event registers are destructive read only reading data from an event register clears the contents of that register Query STATus OPERation BASeband EVENt Chapter 3 133 Programming the Status Register System Status Groups Baseband Operation Event Enable Register The Baseband Operation Event Enable Register lets you choose which bits in the Baseband Operation Event Register can set the summary bit bit 10 of the Standard Operation Status Group Command STATus OPERation BASeband ENABle value where value is the sum of the decimal values of the bits you want to enable Example Enable bit 0 and bit 1 so that whenever either of those bits is set to 1 the Baseband Operation Status summary bit of the Standard Operation Status Register is set to 1 send the command ST
113. er Status Group The Data Questionable Power Status Group is used to determine the specific event that set bit 3 in the Data Questionable Condition Register This group consists of the Data Questionable Power Condition Register the Data Questionable Power Transition Filters negative and positive the Data Questionable Power Event Register and the Data Questionable Power Event Enable Register 138 Reverse Power Protection Tripped Unleveled Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Always Zero 0 Data QUEStionable Data Questionable Y Y Y y Y v y v Y Y V Y Y Y Y paer Transition Filter Data QUEStionable LA V VV Y Y Y Y Y Y Y Y Y v a Transition Filter Eo Y d Y Y vit t t t t dd Data QUEStionable 145 44 13 12 4 00987 65432 1 0 Event Register Data QUEStionable POWer Event 15 14 13 12 11 10 98 7 65 4 3 2 1 0 Enable Register To Data Questionable Status Register Bit 3 ck704c Chapter 3 Programming the Status Register System Status Groups Data Questionable Power Condition Register The Data Questionable Power Condition Register continuously monitors the hardware and firmware status of the signal generator condition registers are read only Table 3 8 Data Questionable Power Condition Register Bits Bit Description 0 Reverse Power Protection Tripped A 1 in this bit position indicates that the reverse power protection RPP ci
114. er were written with the assumption that you are familiar with the signal generator s front panel controls and softkey menus If you are not please refer to the User s Guide 151 Downloading and Using Files Types of Memory Types of Memory The signal generator has two types of memory Volatile Memory Data stored in volatile memory cannot be recovered if it is overwritten or if the power is cycled Signal generators with the Option 002 internal baseband generator have 32 megasamples 160 MB of volatile memory Option 602 has 64 megasamples 320 MB of volatile memory This memory is partitioned as follows Option 002 128 megabytes of waveform memory WFM1 Option 602 256 megabytes of waveform memory WFM1 WFMI data is stored in the signal generator s user bbg1 waveform directory The bbg1 directory does not share space with other types of file directories such as bit binary and state Option 002 32 megabytes of marker memory MKR1 Option 602 64 megabytes of marker memory MKR1 MKRI data is stored in the signal generator s user bbg1 markers directory Non volatile Memory Data stored in non volatile memory remains until you delete it Signal generators without an internal hard drive Option 005 have 3 megasamples 15 MB of non volatile storage Signal generators with the optional internal hard drive have approximately 1 gigasample 6 GB of non volatile storage Unlike volatile memory
115. erator s RF state viScanf vi 1i amp num Reads the response integer value Prints the on off RF state if num gt 0 printf Source RF state is on n else printf Source RF state is off n Close the sessions viClose vi viClose defaultRM Generating a CW Signal Using VISA and C This example uses VISA library functions to control the signal generator The signal generator is set for a CW frequency of 500 kHz and a power level of 2 3 dBm Launch Microsoft Visual C 6 0 add the required files and enter the code into your cpp source file The following program example is available on the PSG Documentation CD ROM as visaex4 cpp VA RR RRR RK KR KKK IKK IK KK RR EE RR EE RE o EE RR A a aoa oo aaa aaa RE oaao aaa aooaa RI I oko kok oko ooo PROGRAM FILE NAME visaex4 cpp JJ PROGRAM DESCRIPTION This example demonstrates query commands The signal generator frequency and power level The RF state of the signal generator is turn on and then the state is queried The response will indicate that the RF state is on The RF state is then turned off and queried The response should indicate that the RF state is off The query results are printed to the to the display window J BRK RR KK KKK IKK IKK IKK RR RE RR RR EE RE IRR RR EE RE IRR RE IIR AIR IRA k k k kok kok XX k k ke ke ke include StdAfx h 44 Chapter 2 Programming Examples GPIB Programming Examples
116. ering Card System US kB sec Agilent HP UX 9 x VISA SICL ANSIC EISA 750 Built in E2071C HP UX Agilent VEE 10 01 Agilent BASIC HP UX Agilent HP UX VISA SICL ANSIC EISA 750 Built in E2071D 10 20 Agilent VEE Agilent BASIC HP UX Chapter 1 5 Getting Started Using GPIB Table 1 3 Agilent GPIB Interface Card for HP UX Workstations Interface Operating 10 Library Languages Backplane B Max I0 Buffering Card System US kB sec Agilent HP UX VISA SICL ANSIC PCI 750 Built in E2078A 10 20 Agilent VEE Agilent BASIC HP UX 2 Selecting IO Libraries for GPIB The IO libraries are included with your GPIB interface card These libraries can also be downloaded from the National Instruments website or the Agilent website The following is a discussion on these libraries VISA SICL NI 488 2 VISA is an IO library used to develop IO applications and instrument drivers that comply with industry standards It is recommended that the VISA library be used for programming the signal generator The NI VISA and Agilent VISA libraries are similar implementations of VISA and have the same commands syntax and functions The differences are in the lower level IO libraries NI 488 2 and SICL respectively It is best to use the Agilent VISA library with the Agilent GPIB interface card or NI VISA with the NI PCI GPIB interface card Agilent SICL can be used without the VISA overlay The SICL functions can be call
117. ers 8 meters 4 Verifying GPIB Functionality Use the VISA Assistant available with the Agilent IO Library or the Getting Started Wizard available with the National Instrument IO Library to verify GPIB functionality These utility programs allow you to communicate with the signal generator and verify its operation over the GPIB Refer to the Help menu available in each utility for information and instructions on running these programs If You Have Problems 1 Verify the signal generator s address matches that declared in the program example programs in Chapter 2 use address 19 2 Remove all other instruments connected to the GPIB and re run the program 3 Verify that the GPIB card s name or id number matches the GPIB name or id number configured for your PC GPIB Interface Terms An instrument that is part of a GPIB network is categorized as a listener talker or controller depending on its current function in the network listener A listener is a device capable of receiving data or commands from other instruments Several instruments in the GPIB network can be listeners simultaneously talker A talker is a device capable of transmitting data To avoid confusion a GPIB system allows only one device at a time to be an active talker controller A controller typically a computer can specify the talker and listeners including itself for an information transfer Only one device at a time can be an
118. ess 12 iremote 9 J Java example 103 188 Index LAN DHCP configuration 13 hostname 12 interface 3 interface description 3 IO libraries 12 manual configuration 13 overview 12 program examples 68 sockets 68 sockets LAN 12 TELNET 17 verifying operation 14 VXI 11 12 68 languages 28 libraries 2 3 6 12 22 list error messages 25 listener 7 local echo lack of 20 local function 10 local lockout function 9 M manual operation 8 marker data directories 152 Matlab creating waveform files 157 memory types 152 MS DOS Command Prompt 14 National Instruments GPIB interface card 5 NI 488 2 30 NI 488 2 include files 29 PCI GPIB interface requirements 30 VISA 6 22 negative transition filter description 126 NI 488 2 6 12 22 EnableRemote 9 iblcr 10 ibloc 10 ibrd 12 ibstop 8 Index ibwrt 11 SetRWLS 9 0 OPC commands 121 output command 11 output function 11 P pass thru commands 65 pattern RAM downloading 182 PCI GPIB 30 PERL example 101 ping program 14 polling method status registers 119 ports 73 positive transition filter description 126 PRAM downloads 184 185 programming examples waveform downloading using C 163 waveform downloading using HP BASIC for UNIX 168 waveform generation using C 162 programming languages 28 programming languages common 4 Q queue error 25 R ramp sweep using pass thru commands
119. eted following execution of the OPC command 1 Request Control This bit is always set to 0 the signal generator does not request control 2 Query Error A 1 in this bit position indicates that a query error has occurred Query errors have SCPI error numbers from 499 to 400 3 Device Dependent Error A 1 in this bit position indicates that a device dependent error has occurred Device dependent errors have SCPI error numbers from 399 to 300 and 1 to 32767 4 Execution Error A 1 in this bit position indicates that an execution error has occurred Execution errors have SCPI error numbers from 299 to 200 5 Command Error A 1 in this bit position indicates that a command error has occurred Command errors have SCPI error numbers from 199 to 100 6 User Request Rey Local A 1 in this bit position indicates that the Local Xey has been pressed This is true even if the signal generator is in local lockout mode 7 Power On A in this bit position indicates that the signal generator has been turned off and then on Query ESR Response The decimal sum of the bits set to 1 Example The decimal value 136 is returned The decimal sum 128 bit 7 8 bit 3 Standard Event Status Enable Register The Standard Event Status Enable Register lets you choose which bits in the Standard Event Status Register set the summary bit bit 5 of the Status Byte Register to 1 128 ESE data data is the sum
120. ets parity to NONE 220 OUTPUT 97 RST Outputs reset to the sig gen 230 END End the program Interface Check Using VISA and C This program uses VISA library functions to communicate with the signal generator The program verifies that the RS 232 connections and interface are functional In this example the COM2 port is used The serial port is referred to in the VISA library as ASRL1 or ASRL2 depending on the computer serial port you are using Launch Microsoft Visual C add the required files and enter the following code into the cpp source file The following program example is available on the PSG Documentation CD ROM as rs232ex1 cpp J RR RRR RRR KK KK Kk Ck oko kk Ck KK IKK IKK IKK Kk KC KK KK Ck Ck Kk KC KR RR RE EE k k kok Ck ko kk ke RE ko kk oko ke kk X ke ke PROGRAM NAME rs232exl cpp PROGRAM DESCRIPTION This code example uses the RS 232 serial interface to control the signal generator Chapter 2 107 Programming Examples RS 232 Programming Examples Connect the computer to the signal generator using an RS 232 serial cable The user is asked to set the signal generator for a 0 dBm power level A reset command RST is sent to the signal generator via the RS 232 interface and the power level will reset to the 135 dBm level The default attributes e g 9600 baud no parity 8 data bits 1 stop bit are used These attributes can be changed using VISA functions ff I
121. front panel restores manual operation The parameter id is the session identifier Local Lockout Function The Agilent BASIC function LOCAL LOCKOUT and the other listed IO library functions can be used to disable the front panel keys including the Local key With the Local key disabled only the controller or a hard reset of the line power switch can restore local control Agilent BASIC VISA NI 488 2 Agilent SICL 10 LOCAL LOCKOUT 719 N A SetRWLS parameter list igpibllo id Agilent BASIC The LOCAL LOCKOUT function disables all front panel signal generator keys Return to local control can occur only with a hard on off when the LOCAL command is sent or if the Preset key is pressed VISA Library The VISA library at this time does not have a similar command NI 488 2 Library The NI 488 2 library function places the instrument described in the parameter list in remote mode by asserting the Remote Enable REN GPIB line The lockout state is then set using the Local Lockout LLO GPIB message Local control can be restored only with the EnableLocal NI 488 2 routine or hard reset The parameter list describes the interface or device descriptor SICL The Agilent SICL igpibllo function prevents user access to front panel keys operation Chapter 1 The function puts an instrument identified by the id parameter into remote mode with local lockout The parameter idis the session identifier and instrument address list Gett
122. g program example is available on the PSG Documentation CD ROM as visaex5 cpp J RR RRR kok k RE RR EE RR EE RE RR EE o EE RE RR EE o Kk Ck KK Ck Ck Kk Ck Kk Ck KK Ck KC Kk Ck kk k k kk Ck RX ko kk k ko IO ke RX X k k PROGRAM FILE NAME visaex5 cpp ff PROGRAM DESCRIPTION This example sets the signal generator FM source to External 2 coupling to AC deviation to 20 kHZ carrier frequency to 700 MHz and the power level to 2 5 dBm The RF state is set to on J BR RK RR KK IK KK I k o kok k oko KK RR RE k k kok k oko kok kok k k kok k kok kok kok k k kok kok RR k kok kok kok ko k kok k k k k k k k He include lt visa h gt include StdAfx h include lt iostream gt include lt stdlib h gt include lt conio h gt void main ViSession defaultRM vi Declares variables of type ViSession for instrument communication ViStatus viStatus 0 Declares a variable of type ViStatus for GPIB verifications Initialize VISA session viStatus viOpenDefaultRM amp defaultRM open session to gpib device at address 19 viStatus viOpen defaultRM GPIB 19 1INSTR VI NULL VI NULL amp vi if viStatus If problems then prompt user Chapter 2 47 Programming Examples GPIB Programming Examples printf Could not open ViSession n printf Check instruments and connections Mn prince An exit 0 printf Example program to set up the signal generator n printf for an AC couple
123. he Microsoft Visual C 6 0 IDE Pentium is a U S registered trademark of Intel Corporation 28 Chapter 2 Programming Examples Using the Programming Examples e National Instruments PCI GPIB interface card or Agilent GPIB interface card e National Instruments VISA Library or Agilent VISA library COMI or COM2 serial port available LAN interface card The Agilent BASIC examples were run on a UNIX 700 Series workstation Running C C Programming Examples To run the example programs written in C C you must include the required files in the Microsoft Visual C 6 0 project If you are using the VISA library do the following e add the visa32 lib file to the Resource Files e add the visa h file to the Header Files If you are using the NI 488 2 library do the following add the GPIB 32 OBJ file to the Resource Files e add the windows h file to the Header Files e add the Deci 32 h file to the Header Files Refer to the National Instrument website for information on the NI 488 2 library and file requirements For information on the VISA library see the Agilent website or National Instrument s website Chapter 2 29 Programming Examples GPIB Programming Examples GPIB Programming Examples e Interface Check using Agilent BASIC on page 31 e Interface Check Using NI 488 2 and C on page 32 e Interface Check using VISA and C on page 33 Local Lockout Using Agilent BASIC on page 34 e Local Locko
124. he computer will respond to the SRQ and depending on the code can perform some other operation or notify the user of failures or other conditions This program sets up a step sweep function for the signal generator and while the operation is in progress prints out a series of asterisks When the step sweep operation is complete an SRQ is generated and the printing ceases Launch Microsoft Visual C 6 0 add the required files and enter the following code into your cpp source file This example is available on the PSG Documentation CD ROM as visaex10 cpp J BR RK KKK I KKK I IK RR RE A e k kok k kok kok oko k kok k kok kok kok k k kok k oko k kok k k XX k k k k XX k k PROGRAM FILE NAME visaex10 cpp PROGRAM DESCRIPTION This example demonstrates the use of a Service Request SRQ interupt The program sets up conditions to enable the SRQ and then sets the signal generator for a step mode sweep The program will enter a printing loop which prints an character and ends when the sweep has completed and an SRQ received bf J BR RRR RR KK KKK I KK IKK KK I RR EE RR EE RE KK RR RR kok oko k kok k kok RR k RR I I XX include visa h include lt stdio h gt 60 Chapter 2 Programming Examples GPIB Programming Examples include StdAfx h include windows h include lt conio h gt define MAX_CNT 1024 int sweep 1 End of sweeep flag Prototypes ViStatus _VI_FUNCH interupt ViSes
125. he condition monitored by a particular bit becomes true the bit sets to 1 When the condition becomes false the bit resets to 0 Monitoring Whether a Condition Bit has Changed The transition registers determine which bit transition condition change should be recorded as an event The transitions can be positive to negative negative to positive or both To monitor a certain condition enable the bit associated with the condition in the associated positive and negative registers Once you have enabled a bit via the transition registers the signal generator monitors it for a change in its condition If this change in condition occurs the corresponding bit in the event register will be set to 1 When a bit becomes true set to 1 in the event register it stays set until the event register is read or is cleared You can thus query the event register for a condition even if that condition no longer exists The event register can be cleared only by querying its contents or sending the CLS command which clears all event registers Monitoring When a Condition Bit Changes Once you enable a bit the signal generator monitors it for a change in its condition The transition registers are preset to register positive transitions a change going from 0 to 1 This can be changed so the selected bit is detected if it goes from true to false negative transition or if either transition occurs 118 Chapter 3 Programming the Status Register Syste
126. he controller do something else while waiting when you can t afford the performance penalty inherent to polling Using the Service Request SRQ M ethod The programming language I O interface and programming environment must support SRQ interrupts for example BASIC or VISA used with GPIB and VXI 11 over the LAN Using this method you must do the following 1 oe qe oN Determine which bit monitors the condition Send commands to enable the bit that monitors the condition transition registers Send commands to enable the summary bits that report the condition event enable registers Send commands to enable the status byte register to monitor the condition Enable the controller to respond to service requests Chapter 3 119 Programming the Status Register System Accessing Status Register Information The controller responds to the SRQ as soon as it occurs As a result the time the controller would otherwise have used to monitor the condition as in a loop method can be used to perform other tasks The application determines how the controller responds to the SRQ When a condition changes and that condition has been enabled the RQS bit in the status byte register is set In order for the controller to respond to the change the Service Request Enable Register needs to be enabled for the bit s that will trigger the SRQ Generating a Service Request The Service Request Enable Register lets you choose the bits in the
127. he following command to download it to the signal generator put marker file name directory name file name 1 where marker file name is the name of the file to download directory name is the name of the directory USER MARKERS USER BBG1 WAVEFORM or USER BBG1 MARKERS file name 19 is the name designator for the file in the signal generator s directory Marker files and the associated I Q waveform file have the same name NOTE If no marker file is provided the signal generator automatically creates a default marker file consisting of all zeros 6 Atthe ftp prompt type bye 7 Atthe command prompt type exit Example Programs Waveform Generation Using MATLAB Matlab is a programming tool that can be used to create specialized waveforms such as radar and pulse sequences Using Matlab and Agilent s integrated Download Assistant utility you can create a single function that will build a waveform preconfigure the waveform with playback setting information and download the waveform to the signal generator s volatile memory for playback or sequencing Chapter 4 157 Downloading and Using Files Downloading ARB Waveform Data The following Matlab M file programming example generates and downloads a pulse pattern waveform file through the PSG vector signal generator s GPIB interface A copy is also available on the PSG Documentation CD ROM as pulsepat m Script file pulsepat m
128. he signal generator The hostname IP address gateway and subnet mask are not affected by an instrument preset or by a power cycle 7 Connect the signal generator to the LAN using a IOBASE T LAN cable DHCP Configuration 1 Press Utility gt GPIB RS 232 LAN gt LAN Setup NOTE If the DHCP server uses dynamic DNS to link the hostname with the assigned IP address the hostname may be used in place of the IP address Otherwise the hostname is not usable and you may skip steps 2 through 4 2 Press Hostname 3 Use the labeled text softkeys and or numeric keypad to enter the desired hostname To erase the current hostname press Editing Keys Clear Text 4 Press Enter 5 Set LAN Config Manual DHCP to DHCP Chapter 1 13 Getting Started Using LAN 6 Press the Proceed With Reconfiguration softkey and then the Confirm Change Instrument will Reboot softkey This configures the signal generator as a DHCP client In DHCP mode the signal generator requests a new IP address from the DHCP server upon rebooting You can return to the LAN Setup menu after rebooting to determine the assigned IP address 7 Connect the signal generator to the LAN using a IOBASE T LAN cable 3 Verifying LAN Functionality Verify the communications link between the computer and the signal generator remote file server using the ping utility Compare your ping response to those described in Table 1 5 From a UNIX workstation type ping hostname
129. icrosoft Visual C 6 0 environment 1 Rename the lanio c to lanio cpp and getopt c to getopt cpp and add them to the Source folder of the Visual C project 2 Select Rebuild All from Build menu Then select Execute Lanio exe 3 Click Start click Programs then click Command Prompt 4 Atthe command prompt cd to the directory containing the lanio cpp file and then to the Debug folder For example CASocketIOW anio Debug 5 Typein lanio xxxxx IDN at the command prompt For example C SocketIO Lanio Debug gt lanio xxxxx IDN where the xxxxx is the hostname of your signal generator Use this format to output SCPI commands to the signal generator in a line by line format from the command prompt 6 Type exit at the command prompt to quit the program The int mainl function will output a sequence of commands in a program format If you want to run a 74 Chapter 2 Programming Examples LAN Programming Examples program using a sequence of commands then perform the following 1 3 Enter the hostname of your signal generator in the openSocket function of the mainl function of the lanio c program Rename the lanio cpp int mainl function to int main and the original int main function to int mainl Select Rebuild All from Build menu Then select Execute Lanio exe The program will run and display the results as shown in Figure 2 2 Figure 2 2 Program Output Screen C GPIB Test lanio Debug Lanio ex
130. ignal generator should now be in local mode n return 0 Queries Using Agilent BASIC This example demonstrates signal generator query commands The signal generator can be queried for conditions and setup parameters Query commands are identified by the question mark as in the identify command IDN The following program example is available on the PSG Documentation CD ROM as basicex3 txt 10 20 30 40 50 60 Vo oko ck kk Cock Ck Ce Ck Ck Ce kk Ck Ce kk Ck XX A Ck ke kk kk ke kk kk ke kk kk XX A kk XX A kk ko sk ke kk ko ko sk ko RR RR kA k kk ck ko ko kok I PROGRAM NAME basicex3 txt PROGRAM DESCRIPTION In this example query commands are used with response data formats Chapter 2 37 Programming Examples GPIB Programming Examples 70 80 90 00 10 20 30 40 50 60 70 80 90 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 38 CLEAR and RESET the controller and RUN the following program PKK KKK KK KKK KK KKK KKK KKK KKK KKK KKK KK KKK KKK KKK KKK KKK KKK KKK KKK RR KK KKK KKK KKK KKK ko ko k ko ko KK DIM A 10 C 100 D 10 Declares variables to hold string response data INTEGER B Declares variable to hold integer response data Sig_gen 719 Declares variable to hold signal generator address LOCAL Sig_gen Puts signal generator in Local mode CLEAR Sig_gen Resets parser and clears any pending output CLEAR
131. ile D home TEST_WAVE enter file location on PC workstation const char instDestFile USER BBG1 WAVEFORM TEST_WAVE for non volatile memory remove BBG1 from file path Size of the copy buffer const int BUFFER SIZE 10071024 int main INST id iopen instOpenString if id fprintf stderr iopen failed s n instOpenString return 1 FILE file fopen localSrcFile rb if file fprintf stderr Could not open file s n localSrcFile return 0 if fseek file 0 SEEK END lt 0 164 Chapter 4 fprintf stderr Cannot seek to the end of file n return 0 long lenToSend ftell file printf File size d n lenToSend if fseek file 0 SEEK_SET lt 0 fprintf stderr Cannot seek to the start of file n return 0 char buf new char BUFFER_SIZE if buf amp amp lenToSend Prepare and send the SCPI command header char s 20 sprintf s d lenToSend int lenLen strlen s char s2 256 sprintf s2 mmem data s d d instDestFile lenLen iwrite id s2 strlen s2 0 0 Send file in BUFFER_SIZE chunks long numRead do numRead fread buf sizeof char BUFFER_SIZE file iwrite id buf numRead 0 0 while numRead BUFFER SIZE Send the terminating newline and EOM iwrite id n 1 1 0 Chapter 4 Downloading and Using Files Downloading ARB Waveform Data lenToSend
132. ing Started Using GPIB Local Function The Agilent BASIC function LOCAL and the other listed functions cause the signal generator to return to local control with a fully enabled front panel Agilent BASIC VISA NI 488 2 Agilent SICL 10 LOCAL 719 N A ibloc int ud iloc id Agilent BASIC VISA Library NI 488 2 Library SICL Clear Function The LOCAL 719 function returns the signal generator to manual operation allowing access to the signal generator s front panel keys The VISA library at this time does not have a similar command The NI 488 2 library function places the interface in local mode and allows operation of the signal generator s front panel keys The ud parameter in the parameter list is the interface or device descriptor The Agilent SICL function puts the signal generator into Local operation enabling front panel key operation The id parameter identifies the session The Agilent BASIC function CLEAR and the other listed IO library functions cause the signal generator to assume a cleared condition Agilent BASIC VISA NI 488 2 Agilent SICL 10 CLEAR 719 viClear ViSession vi ibclr int ud iclear id Agilent BASIC The CLEAR 719 function causes all pending output parameter operations to be halted the parser interpreter of programming codes to reset and prepare for a new programming code stops any sweep in progress and continuous sweep t
133. input viPrintf vi STAT QUES POW ENAB 2 n Enables the Data Questionable Power Condition Register Bits Bits 0 and 1 viPrintf vi STAT QUES POW COND Mn Querys the register for any set bits viScanf vi s rdBuffer Reads the decimal sum of the set bits num int rdBuffer 1 0 Converts string data to numeric Chapter 2 57 Programming Examples GPIB Programming Examples switch num Based on the decimal value case 1 printf Signal Generator Reverse Power Protection Tripped n printf tint break case 23 printf Signal Generator Power is Unleveledin prince nt break default printf No Power Unleveled condition detected n printfi Xn s viClear vi Clears the signal generator Prints user information print Naan a a ee a ee ea n printf Nn printf Manually set up the sig gen for an unleveled output condition n printf tat printf Select AM modulationin printf Select AM Source Ext 1 and Ext Coupling AC n printf Turn On the modulation n printf Do not connect any source to the input in printf Check signal generator s display for the EXT1 LO annunciatorin printf n printf Press Enter when ready n printfi Xn s getch Waits for keyboard user input viPrintf vi STAT QUES MOD ENAB 16 n Enables the Data Questionable 58 Chapter 2 bits TOTTI viPrintf vi
134. ints 100 End of loop 120 Calculates number of bytes in I Q waveform Chapter 4 169 Downloading and Using Files Downloading ARB Waveform Data Program Comments Continued 130 Opens an I O path to the signal generator using GPIB 7 the address of the GPIB card in the computer and 19 is the address of the signal generator This I O path is used to send ASCII data to the signal generator 140 Opens an I O path for sending binary data to the signal generator 150 Creates an ASCII string representation of the number of bytes in the waveform 160 to 170 Finds the number of digits in Nbytes 190 Sends the first part of the SCPI command MEM DATA along with the name of the file data file that will receive the waveform data The name data_file will appear in the signal generator s memory catalog 200 to 210 Sends the rest of the ASCII header 230 Sends the binary data Note that P sgb is the binary I O path 240 Sends an End of Line to terminate the transmission 250 to 260 Closes the connections to the signal generator 290 End the program Loading and Playing a Downloaded Waveform 1 Select the downloaded waveform file in NVWFM and load it into WFM1 Via the front panel a Press Mode gt Dual ARB gt Select Waveform gt Waveform Segments gt Load Store b Inthe NVWFM catalog highlight the desired waveform file and select Load Segment From NVW FM Memor
135. ister system to monitor error conditions and or condition changes The signal generator s status register system provides two major advantages e You can monitor the settling of the signal generator using the settling bit of the Standard Operation Status Group s condition register e You can use the service request SRO interrupt technique to avoid status polling therefore giving a speed advantage The signal generator s instrument status system provides complete SCPI standard data structures for reporting instrument status using the register model The SCPI register model of the status system has multiple registers that are arranged in a hierarchical order The lower level status registers propagate data to the higher level registers using summary bits The Status Byte Register is at the top of the hierarchy and contains the status information for lower level registers The lower level status registers monitor specific events or conditions and are grouped according to their functionality For example the Data Questionable Frequency Status Group consists of five registers This chapter may refer to a group as a register so that the cumbersome correct description is avoided For example the Standard Operation Status Group s Condition Register can be referred to as the Standard Operation Status register Refer to Status Groups on page 126 for more information Figure 3 1 and Figure 3 2 show the signal generator s status byte r
136. k k KK k k k k k k kk k kkk k kk k kk k kkk KK kk k k if the command has a in it use queryInstrument otherwise simply send the command ROR RK KK KKK IK KR KK I o kok k kok k kok k k kok RR EE k oko k EE ke Kee EX if isQuery command long bufBytes bufBytes queryInstrument instSock command charBuf INPUT BUF SIZE if quiet fwrite charBuf bufBytes 1 stdout fwrite n 1 1 stdout 94 Chapter 2 fflush stdout else commandInstrument instSock command else read a line from lt stdin gt while gets charBuf NULL if strlen charBuf continue if charBuf charBuf continue streat charBuf n if quiet if number char num 10 sprintf num zd number tt fwrite num strlen num 1 stdout fwrite charBuf strlen charBuf fflush stdout Chapter 2 1 stdout Programming Examples LAN Programming Examples 95 Programming Examples LAN Programming Examples if isQuery charBuf long bufBytes Put the query response into the same buffer as the command string appended after the null terminator bufBytes queryInstrument instSock charBuf charBuf strlen charBuf 1 INPUT_BUF_SIZE strlen charBuf if quiet fwrite 2 1 stdout fwrite charBuf strlen charBuf 1 bufBytes 1 stdout fwrite n 1 1 stdout
137. ko k k Kk k CK Ck Ck Ck Ck Ck Kk k k k kok k kk k ke EX kok k kk ke ke ke ke int commandInstrument SOCKET sock 82 Chapter 2 Programming Examples LAN Programming Examples const char command int count fprintf stderr Sending Ss n command if strchr command n NULL fprintf stderr Warning missing newline on command s n command count send sock command strlen command 0 if count SOCKET_ERROR return COMMAND_ERROR return NO_CMD_ERROR RRR KK KKK I KK I ko oko kok k oko k oko kok k oko kok oko k kok k kok kok kok k k IRI k k kk kkk k kk k k k k k recv line similar to fgets but uses recv A char recv line SOCRET sock char result int maxLength ifdef WINSOCK int cur_length 0 int count char ptr result int err 1 while cur_length lt maxLength Get a byte into ptr count recv sock ptr 1 0 Chapter 2 83 Programming Examples LAN Programming Examples If no chars to read stop if count lt 1 break cur length count If we hit a newline stop if ptr Mn ptr tt err 0 break ptrtt ptr NO if err return NULL else return result else RRR ok k KK KK KK IK KR IKK KKK IK IK KKK RR IK EE k k k RR EE RE RR k kok k k k k k k HK Simpler UNIX version using file I O recv version works too This demonstrates how to use file I O on so
138. l j inthe HyperTerminal window The Ctrl j gt is the new line character on the keyboard press the Cntrl key and the j key simultaneously The signal generator should return a string similar to the following depending on model Agilent Technologies instrument model name and number US40000001 C 02 00 Character Format Parameters The signal generator uses the following character format parameters when communicating via RS 232 e Character Length Eight data bits are used for each character excluding start stop and parity bits e Parity Enable Parity is disabled absent for each character e Stop Bits One stop bit is included with each character 24 Chapter 1 Getting Started Error Messages If You Have Problems ES Verify that the baud rate parity and stop bits are the same for the computer and signal generator Verify that the RS 232 cable is identical to the cable specified in Table 1 6 3 Verify that the application is using the correct computer COM port and that the RS 232 cable is properly connected to that port Verify that the controller s flow control is set to RTS CTS Error Messages If an error condition occurs in the signal generator it is reported to both the SCPI remote interface error queue and the front panel display error queue These two queues are viewed and managed separately for information on the front panel display error queue refer to the User s Guide When accessing error message
139. languages and remote mode are available using the RS 232 interface The serial port sends and receives data one bit at a time therefore RS 232 communication is slow The data transmitted and received is usually in ASCII format with SCPI commands being sent to the signal generator and ASCII data returned 1 Selecting IO Libraries for RS 232 The IO libraries can be downloaded from the National Instrument website www ni com or Agilent s website www agilent com The following is a discussion on these libraries Agilent BASIC The Agilent BASIC language has an extensive IO library that can be used to control the signal generator over the RS 232 interface This library has many low level functions that can be used in BASIC applications to control the signal generator over the RS 232 interface VISA VISA is an IO library used to develop IO applications and instrument drivers that comply with industry standards It is recommended that the VISA library be used for programming the signal generator The NI VISA and Agilent VISA libraries are similar implementations of VISA and have the same commands syntax and functions The differences are in the lower level IO libraries used to communicate over the RS 232 NI 488 2 and SICL respectively NI 488 2 NI 488 2 IO libraries can be used to develop applications for the RS 232 interface See National Instrument s website for information on NI 488 2 SICL Agilent SICL can be used to develop applicati
140. le on the PSG Documentation CD ROM as visaex6 cpp J RR RRR RRR KR KKK IKK KK KKK RR EE RAE KK KKK IKK RR EE RR EE RE RR I EE RR EE RE RR IK I k k XX A k PROGRAM FILE NAME visaex6 cpp MHz carrier frequency and a power level of 15 dBm deviation 100 kHz if PROGRAM DESCRIPION This example generates an AC coupled internal FM signal at a 900 The FM rate is 5 kHz and the peak JKR KK KR KK IK KK IKK RR KR RR k kok RR RAR IRR IAAI RI RRR EE k kok kok k kok k kk k k XX EX HE include lt visa h gt include StdAfx h include lt iostream gt include lt stdlib h gt include lt conio h gt void main ViSession defaultRM vi ViStatus viStatus 0 viStatus viOpenDefaultRM amp defaultRM open viStatus viOpen defaultRM GPIB 19 if viStatus Chapter 2 INSTR Declares variables of type ViSession for instrument communication Declares a variable of type ViStatus for GPIB verifications Initialize VISA session session to gpib device at address 19 VI NULL VI NULL amp vi If problems then prompt user 49 Programming Examples GPIB Programming Examples printf Could not open ViSession n printf Check instruments and connectionsin Serine ntj exit 0 printf Example program to set up the signal generatorin printf for an AC coupled FM signal n printf Anty printf Press any key to continue n getch viClear vi
141. lent VISA library for programming the signal generator over the LAN interface SICL Agilent SICL is a lower level library that is installed along with Agilent VISA 2 Setting Up the LAN Interface For LAN operation the signal generator must be connected to the LAN and an IP address must be assigned to the signal generator either manually or by using DHCP client service Your system administrator can tell you which method to use 12 Chapter 1 Getting Started Using LAN Manual Configuration 1 Press Utility gt GPIB RS 232 LAN gt LAN Setup gt Hostname 2 Use the labeled text softkeys and or numeric keypad to enter the desired hostname To erase the current hostname press Editing Keys gt Clear Text 3 Press Enter 4 Set LAN Config Manual DHCP to Manual 5 Press IP Address and enter a desired address Use the left and right arrow keys to move the cursor Use the up and down arrow keys front panel knob or numeric keypad to enter an IP address To erase the current IP address press the Clear Text softkey NOTE To remotely access the signal generator from a different LAN subnet you must also enter the subnet mask and default gateway See your system administrator for the appropriate values 6 Press the Proceed With Reconfiguration softkey and then the Confirm Change Instrument will Reboot softkey This action assigns a hostname and IP address as well as a gateway and subnet mask if these have been configured to t
142. m Accessing Status Register Information Deciding How to Monitor You can use either of two methods described below to access the information in status registers both methods allow you to monitor one or more conditions The polling method In the polling method the signal generator has a passive role It tells the controller that conditions have changed only when the controller asks the right question This is accomplished by a program loop that continually sends a query The polling method works well if you do not need to know about changes the moment they occur Use polling in the following situations when you use a programming language development environment or I O interface that does not support SRQ interrupts when you want to write a simple single purpose program and don t want the added complexity of setting up an SRQ handler The service request SRQ method In the SRQ method described in the following section the signal generator takes a more active role It tells the controller when there has been a condition change without the controller asking Use the SRQ method if you must know immediately when a condition changes To detect a change using the polling method the program must repeatedly read the registers Use the SRQ method in the following situations when you need time critical notification of changes when you are monitoring more than one device that supports SRQs when you need to have t
143. m it by white space optarg is set to point to the start of the option argument on return from getopt getopt places in optind the argv index of the next argument to be processed The external variable optind is initialized to 1 before the first call to the function getopt When all options have been processed i e up to the first non option Chapter 2 99 Programming Examples LAN Programming Examples argument getopt returns EOF The special option can be used to delimit the end of the options EOF is returned and is skipped Fe KR RR RE RR EE RR EE RR EE RR KK RR RR Kk Ck IRR RR k oko k Kk Ck ko kk ko ko k kk XX ke ke ke ke ke include lt stdio h gt For NULL EOF include lt string h gt For strehr char toptarg Global argument pointer int optind 0 Global argv index static char scan NULL Private scan pointer int getopt int argc char const argv const char optstring char c char posn optarg NULL if scan NULL scan O if optind 0 optind if optind gt argc argv optind 0 argv optind 1 0 return EOF if strcmp argv optind 0 optind return EOF 100 Chapter 2 scan argv optind 1 optind c scantt posn strchr optstring c DDP if posn NULL c Ss unknown option e n argv 0 oe fprintf stderr return posn
144. me as the input format Binary Directory Dow nloads The binary directory user binary requires that data be formatted in 8 bit bytes Files stored or downloaded to a binary directory are converted to bit files prior to editing in the bit file editor after which they are stored in a bit directory as bit files A bit directory is preferred for user file downloads SCPI Commands MMEM DATA file name datablock Send this command to download the user file data into the signal generator s binary directory The variable file name denotes the name of the downloaded user file stored in the signal generator Sample Command Line MMEM DATA file name ABC file name the name of the user file stored in the signal generator s memory HA the number of decimal digits to follow in B B a decimal number specifying the number of data bytes in C C the binary user file data Example MMEM DATA file name 419128407897 file name provides the user file name as it will appear in the signal generator s binary memory catalog 1 defines the number of decimal digits to follow in B 9 denotes how many bytes of data are to follow 12S407897 the ASCII representation of the data that is downloaded to the signal generator This variable is represented by C in the sample command line Chapter 4 177 Downloading and Using Files Downloading User File Data Querying the Waveform Data Use the following SCPI comm
145. ment following a header was evaluated by the device as outside of its legal input range or is otherwise inconsistent with the device s capabilities or avalid program message could not be properly executed due to some device condition Execution errors are reported after rounding and expression evaluation operations are completed Rounding a numeric data element for example is not reported as an execution error Command Errors 199 to 100 indicate that the instrument s parser detected an IEEE 488 2 syntax error Errors in this class set the command error bit bit 5 in the event status register IEEE 488 2 section 11 5 1 In this case Either an IEEE 488 2 syntax error has been detected by the parser a control to device message was received that is in violation of the IEEE 488 2 standard Possible violations include a data element that violates device listening formats or whose type is unacceptable to the device or anunrecognized header was received These include incorrect device specific headers and incorrect or unimplemented IEEE 488 2 common commands 26 Chapter 1 2 Programming Examples This chapter provides the following major sections Using the Programming Examples on page 28 GPIB Programming Examples on page 30 LAN Programming Examples on page 68 RS 232 Programming Examples on page 106 27 Programming Examples Using the Programming Examples Using the Programming Examples The programmi
146. modulation d Turn on the RF output oof Via the remote interface SOURce RADio lt desired format gt FILTer lt file_name gt SOURCe RADio CUSTom STATe On Troubleshooting FIR Filter Coefficient File Download Problems Symptom Possible Cause ERROR 321 There is not enough memory available for the FIR coefficient file being downloaded Out of memory Either reduce the FIR file size or delete unnecessary files from memory ERROR 223 User FIR filter has too many symbols Too much data Real Time cannot use a filter with more than 64 symbols 5 12 symbols maximum for ARB You may have specified an incorrect oversample ratio in the filter table editor NOTE Review Data Requirements and Limitations on page 179 Chapter 4 181 Downloading and Using Files Downloading Directly into Pattern RAM PRAM Downloading Directly into Pattern RAM PRAM NOTE References to pattern RAM PRAM are for descriptive purposes only relating to the manner in which the memory is being used PRAM and volatile waveform memory WFM1 actually utilize the same storage media Typically the signal generator s firmware generates the required data and framing structure and loads this data into Pattern RAM PRAM The data is read by the baseband generator which in turn is input to the I Q modulator The signal generator can also accept data downloads directly into PRAM from a computer Programs such as MATLAB o
147. mple for PRAM uses 4 bytes of data A data pattern file containing 8 megabits of modulation data must contain another 56 megabits of control information A file of this size requires 8 megabytes of memory 3 For every bit of modulation data bit 0 you must provide 7 bits of control information bits 1 7 The signal generator processes data in 8 bit bytes Each byte contains bit of data field information and seven bits of control information associated with the data field bit See the following table for the required data and control bits Bit Function Value Comments 0 Data 0 1 The data to be modulated unspecified when burst bit 2 0 1 Reserved 0 Always 0 2 Burst 0 1 Set to 1 RF on Set to 0 RF off For non bursted non TDMA systems this bit is set to 1 for all memory locations leaving RF output on continuously For framed data this bit is set to 1 for on timeslots and 0 for off timeslots 3 Reserved 0 Always 0 4 Reserved 1 Always 1 5 Reserved 0 Always 0 6 Eventl Output 0 1 Set to 1 a level transition at the EVENT 1 BNC connector Use examples as a marker output to trigger external hardware when data pattern restarts toggling in alternate addresses to create a data synchronous pulse train 7 Pattern Reset 0 1 Set to 0 continue to next sequential memory address Set to 1 end of memory and restart memory playback Set to 0 for all bytes except last address of
148. ng examples for remote control of the signal generator use the GPIB LAN and RS 232 interfaces and demonstrate instrument control using different I O libraries and programming languages Many of the example programs in this chapter are interactive the user will be prompted to perform certain actions or verify signal generator operation or functionality Example programs are written in the following languages e Agilent BASIC e C C e Java e PERL See Chapter 1 of this programming guide for information on interfaces I O libraries and programming languages The example programs are also available on the PSG Documentation CD ROM enabling you to cut and paste the examples into a text editor NOTE The example programs set the signal generator into remote mode front panel keys except the Local key are disabled Press the Local key to revert to manual operation NOTE To update the signal generator s front panel display so that it reflects remote command setups enable the remote display press Utility gt Display gt Update in Remote Off On softkey until On is highlighted or send the SCPI command DISPlay REMote ON For faster test execution disable front panel updates Programming Examples Development Environment The C C examples in this guide were written using an IBM compatible personal computer PC with the following configuration e Pentium processor e Windows NT 4 0 operating system e C C programming language with t
149. o be turned off VISA Library The VISA library uses the viClear function This function performs an IEEE 488 1 clear of the signal generator NI 488 2 Library The NI 488 2 library function sends the GPIB Selected Device Clear SDC message to the device described by ud SICL The Agilent SICL function clears a device or interface The function also discards data in both the read and write formatted IO buffers The id parameter identifies the session 10 Chapter 1 Output Function Getting Started Using GPIB The Agilent BASIC IO function OUTPUT and the other listed IO library functions put the signal generator into a listen mode and prepare it to receive ASCII data typically SCPI commands Agilent BASIC VISA NI 488 2 Agilent SICL 10 OUTPUT 719 viPrintf parameter ibwrt parameter iprintf parameter list list list Agilent BASIC VISA Library NI 488 2 Library SICL Enter Function The function OUTPUT 719 puts the signal generator into remote mode makes it a listener and prepares it to receive data The VISA library uses the above function and associated parameter list to output data This function formats according to the format string and sends data to the device The parameter list describes the session id and data to send The NI 488 2 library function addresses the GPIB and writes data to the signal generator The parameter list includes the instrument address session id and the data to send
150. o control the signal generator The signal generator is set to a 1 GHz CW frequency and then queried for its ID string Before running this code you must set up the interface using the Agilent IO Libraries IO Config utility The following program example is available on the PSG Documentation CD ROM as vxisicl cpp J BR KK KR KK KKK kk Ck Ck kk oko Kk A RR RR RR Ck KC Kk kok k k kok k kok Kk kok k k kok kk kk Ck Ck kk k kk k kok k ke kk k k k ke kk k k k PROGRAM NAME vxisicl cpp PROGRAM DESCRIPTION Sample test program using SICL and the VXI 11 protocol 68 Chapter 2 Programming Examples LAN Programming Examples EF NOTE You must have the Agilent IO Libraries installed to run this program This example uses the VXI 11 protocol to set the signal generator for a 1 gHz CW frequency The signal generator is queried for operation complete and then queried for its ID string The frequency and ID string are then printed to the display IMPORTANT Enter in your signal generators hostname in the instrumentName declaration where the xxxxx appears J BR KK kok KK IK KK IK KKK I IKK RR KR IRR k oko k kok k k kok RIK IRR RR EE kok kok kok k kok k kok kok EE XX k k include stdafx h include lt sicl h gt include lt stdlib h gt include lt stdio h gt int main int argc char argv INST id Device session id int opcResponse Variable for response flag char instrumentNam
151. o query the Standard Operation Status Group s Condition Register send the command STATus OPERation CONDition If bit 7 bit 3 and bit 2 in this register are set bits 1 then the query will return the decimal value 140 The value represents the decimal values of bit 7 bit 3 and bit 2 128 8 4 140 Table 3 1 Status Register Bit Decimal Values 23 8 28 288s3 89 9 7 7 Decimal 59 JR IS 8 8 2 9 7 Value 8 7 lt Bit Number 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 NOTE Bit 15 is not used and is always set to zero Chapter 3 117 Programming the Status Register System Accessing Status Register Information Accessing Status Register Information 1 Determine which register contains the bit that reports the condition Refer to Figure 3 1 on page 115 or Figure 3 2 on page 116 for register location and names 2 Send the unique SCPI query that reads that register 3 Examine the bit to see if the condition has changed Determining W hat to M onitor You can monitor the following conditions current signal generator hardware and firmware status e whether a particular condition bit has occurred Monitoring Current Signal Generator Hardware and Firmware Status To monitor the signal generator s operating status you can query the condition registers These registers represent the current state of the signal generator and are updated in real time When t
152. od Modulation Uncalibrated Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Always Zero 0 Data QUEStionable MODulation Condition Register 15 14 13 12 11 100 98 7 65 4 3 2 1 0 Data QUEStionable y V Y VY v Yit tvi v vs MODulation Positive 15 14 13 12 11 10 9 87 654 3 21 O Ti ition Filt DataQUESionabe Y V V Y V Y VY VY V Y Y Y Y3 th 15 14 13 12 11 009 8765432 1 0 Transition Filter Foy Y Y VY v i ivt tv t i l ee 15 14 13 12 1110987654321 0 Event C l EEE ON T wee a TT DE m BOF cake ene wee ee ee eT PRES Event 15 14 13 12 41 100987 654 3 2 1 0 Enable Register To Data Questionable Status Register Bit 7 me 144 Chapter 3 Programming the Status Register System Status Groups Data Questionable M odulation Condition Register The Data Questionable Modulation Condition Register continuously monitors the hardware and firmware status of the signal generator Condition registers are read only Table 3 10 Data Questionable Modulation Condition Register Bits Bit Description 0 Modulation 1 Undermod A 1 in this bit indicates that the External 1 input ac coupling on is less than 0 97 volts 1 Modulation 1 Overmod A 1 in this bit indicates that the External 1 input ac coupling on is greater than 1 03 volts 2 Modulation 2 Undermod A in this bit indicates that the External 2 input ac coupling on is less than 0 97 volts 3 Mo
153. of the decimal values of the bits you want to enable Example Enable bit 7 and bit 6 so that whenever either of those bits is set to 1 the Standard Event Status summary bit of the Status Byte Register is set to 1 send the command ESE 192 128 4 64 Query ESE Response Decimal value of the sum of the bits previously enabled with the ESE data command Chapter 3 Programming the Status Register System Status Groups Standard Operation Status Group The Operation Status Group is used to determine the specific event that set bit 7 in the Status Byte Register This group consists of the Standard Operation Condition Register the Standard Operation Transition Filters negative and positive the Standard Operation Event Register and the Standard Operation Event Enable Register I Q CALibrating Settling Unused SWEeping MEASuring Waiting for TRIGger Unused Unused Unused DCFM DCOM Null in Progress Baseband is busy SWEep Calculating BERT SYNChronizing Unused Unused Always Zero 0 gandard Operation 1 14 13 12 1 009876543210 standard Operation YY Y X X Y Y Y Y Y Y Y Y Y v3 Transition Filter s pi v VY ivive vvi andard Operation Negative 15 14 13 12 11 109 87654 32 1 O Transition Filter p Y v Y v tivi a Event Register On 15 14 13 12 1110987 654 3 2 1 0 r p 1109876543210 Standard Operation EAP ES ETA S Event 15 14 18 12 411009876 54 32 1 0 Enable
154. on aborts any command currently executing with the session id This function is supported with C C on Windows 3 1 and Series 700 HP UX Remote Function The Agilent BASIC function REMOTE and the other listed IO library functions cause the signal generator to change from local operation to remote operation In remote operation the front panel keys are disabled except for the Local key and the line power switch Pressing the Local key on the signal generator front panel restores manual operation Agilent BASIC VISA NI 488 2 Agilent SICL 10 REMOTE 719 N A EnableRemote parameter list iremote id M icrosoft is a registered trademark of M icrosoft Corporation 8 Chapter 1 Agilent BASIC VISA Library NI 488 2 Library SICL Getting Started Using GPIB The REMOTE 719 function disables the front panel operation of all keys with the exception of the Local key The VISA library at this time does not have a similar command This NI 488 2 library function asserts the Remote Enable REN GPIB line All devices listed in the parameter list are put into a listen active state although no indication is generated by the signal generator The parameter list describes the interface or device descriptor The Agilent SICL function puts an instrument identified by the id parameter into remote mode and disables the front panel keys Pressing the Local key on the signal generator
155. ons for the RS 232 interface See Agilent s website for information on SICL 22 Chapter 1 Getting Started Using RS 232 2 Setting Up the RS 232 Interface 1 Press Utility gt GPIB RS 232 LAN gt RS 232 Setup gt RS 232 Baud Rate gt 9600 Use baud rates 57600 or lower only Select the signal generator s baud rate to match the baud rate of your computer or UNIX workstation or adjust the baud rate settings on your computer to match the baud rate setting of the signal generator NOTE The default baud rate for VISA is 9600 This baud rate can be changed with the VI_ATTR_ASRL_BAUD VISA attribute 2 Press Utility gt GPIB RS 232 LAN gt RS 232 Setup gt RS 232 Echo Off On until Off is highlighted Set the signal generator s RS 232 echo Selecting On echoes or returns characters sent to the signal generator and prints them to the display 3 Connect an RS 232 cable from the computer s serial connector to the signal generator s AUXILIARY INTERFACE connector Refer to Table 1 6 for RS 232 cable information Table 1 6 RS 232 Serial Interface Cable Quantity Description Agilent Part Number 1 Serial RS 232 cable 9 pin male to 9 pin 8120 6188 female NOTE Any 9 pin male to 9 pin female straight through cable that directly wires pins 2 3 5 7 and 8 may be used Chapter 1 23 Getting Started Using RS 232 3 Verifying RS 232 Functionality You can use the HyperTerminal program available on yo
156. opcResponse equals 1 System err println Invalid response to OPC System exit 1 System out println Retrieving instrument ID out write idn n Querys the id string 104 Chapter 2 Chapter 2 Programming Examples LAN Programming Examples out flush String idnResponse in readLine Reads the id string Prints the id string System out println Instrument ID idnResponse catch IOException e System out println Error e 105 Programming Examples RS 232 Programming Examples RS 232 Programming Examples e Interface Check Using Agilent BASIC on page 106 e Interface Check Using VISA and C on page 107 Queries Using Agilent BASIC on page 109 Queries Using VISA and C on page 110 Before Using the Examples On the signal generator select the following settings e Baud Rate 9600 must match computer s baud rate e Transmit Pace None e Receive Pace None e RTS CTS None e RS232 Echo Off Interface Check Using Agilent BASIC This example program causes the signal generator to perform an instrument reset The SCPI command RST will place the signal generator into a pre defined state The serial interface address for the signal generator in this example is 9 The serial port used is COMI Serial A on some computers Refer to Using RS 232 on page 22 for more information Watch for the signal generator s Listen annunciator L and the rem
157. or s FIR memory MEMory DATA FIR lt file name gt osr coefficient coefficient Use the following SCPI command line to guery list data from FIR memory MEMory DATA FIR lt file name gt Sample Command Line The following SCPI command downloads a typical set of FIR filter coefficient values and name the file FIR1 MEMory DATA FIR FIR1 4 0 0 0 0 0 0 000001 0 000012 0 000132 0 001101 0 006743 0 030588 0 103676 0 265790 0 523849 0 809508 1 1 0 809508 0 523849 0 265790 0 103676 0 030588 0 006743 0 001101 0 000132 0 000012 0 000001 0 0 0 0 0 FIR1 assigns the name FIR 1 to the associated OSR over sample ratio and coefficient values The file is then represented with this name in the FIR File catalog specifies the oversample ratio 0 4 0 0 0 0 0 000001 represent FIR filter coefficients 180 Chapter 4 Downloading and Using Files Downloading FIR Filter Coefficients Selecting a Downloaded User FIR Filter as the Active Filter Using FIR Filter Data for Custom M odulation Use the following steps to select user FIR filter data as the active filter for a custom modulation format Via the front panel 1 Press Mode gt Custom gt desired format gt Filter gt Select gt User FIR Highlight and select the desired file in the catalog of FIR files Turn on the selected format BB YN Modulate and activate the carrier Set the carrier frequency Set the carrier amplitude Turn on
158. or the active digital communications standard Data Requirements and Limitations Data must be in ASCII format The signal generator processes FIR filter coefficients as floating point numbers Data must be in List format FIR filter coefficient data is processed as a list by the signal generator s firmware See Sample Command Line on page 184 Filters containing more symbols than the hardware allows are not selectable for that configuration The Real Time I Q Baseband FIR filter files are limited to 1024 taps coefficients 64 symbols and a 16 times oversample ratio FIR filter files with more than 64 symbols cannot be used The ARB Waveform Generator FIR filter files are limited to 512 taps and 512 symbols The oversample ratio OSR is the number of filter taps per symbol Oversample ratios from 1 through 32 are possible The maximum combination of OSR and symbols allowed is 32 symbols with an OSR of 32 The sampling period At is equal to the inverse of the sampling rate FS The sampling rate is equal to the symbol rate multiplied by the oversample ratio For example for a symbol rate of 270 83 ksps if the oversample ratio is 4 the sampling rate is 1083 32 kHz and At inverse of FS is 923 088 ns Chapter 4 179 Downloading and Using Files Downloading FIR Filter Coefficients Downloading FIR Filter Coefficients Use the following SCPI command line to download FIR filter coefficients from the PC to the signal generat
159. orm data file must have the same name in the signal generator Chapter 4 Downloading and Using Files Downloading ARB Waveform Data Downloading Waveforms Before they are sequenced and played the waveform data file and the associated marker file must be downloaded into waveform memory The waveform data file can be loaded into the signal generator s waveform or NVWFM memory using the following methods e SCPI using VXI 11 VMEbus Extensions for Instrumentation as defined in VXI 11 e SCPI over the GPIB or RS 232 interface e SCPI with sockets LAN using port 5025 File Transfer Protocol FTP Refer to Using FTP on page 157 for information on FTP Sample Command Line Using SCPI SCPI command Arbitrary Block Data Arbitrary Block Data is defined in the IEEE std 488 2 1992 section 7 7 6 The following is an example of the format as used to download waveform data to the signal generator MMEM DATA WFM1 lt file name ABC file name thename ofthe waveform file stored in the signal generator A the number of decimal digits to follow in B B a decimal number specifying the number of data bytes in C C the binary waveform data Example 1 MMEM DATA WFM1 FILENAME 3240 lt 240 bytes of data FILENAME the file name to appear in the signal generator s waveform memory catalog 3 3 decimal digits will be used to define the number of data bytes 240 240 bytes of data will follow
160. ors 499 to 400 indicate that the instrument s output queue control has detected a problem with the message exchange protocol described in IEEE 488 2 Chapter 6 Errors in this class set the query error bit bit 2 in the event status register IEEE 488 2 section 11 5 1 These errors correspond to message exchange protocol errors described in IEEE 488 2 6 5 In this case e Either an attempt is being made to read data from the output queue when no output is either present or pending or e data in the output queue has been lost Device Specific Errors 399 to 300 201 to 703 and 800 to 810 indicate that a device operation did not properly complete possibly due to an abnormal hardware or firmware condition These codes are also used for self test response errors Errors in this class set the device specific error bit bit 3 in the event status register IEEE 488 2 section 11 5 1 The lt error_message gt string for a positive error is not defined by SCPI A positive error indicates that the instrument detected an error within the GPIB system within the instrument s firmware or hardware during the transfer of block data or during calibration Execution Errors 299 to 200 indicate that an error has been detected by the instrument s execution control block Errors in this class set the execution error bit bit 4 in the event status register IEEE 488 2 section 11 5 1 In this case Either a PROGRAM DATA ele
161. ote preset message on the front panel display If there is no indication check that the RS 232 cable is properly connected to the computer serial port and that the manual setup listed above is correct If the compiler displays an error message or the program hangs it is possible that the program was typed incorrectly Press the signal generator s Reset RS 232 softkey and re run the program Refer to If You Have Problems on page 7 for more help The following program example is available on the PSG Documentation CD ROM as rs232ex1 txt 1O LK KKK KK kk kk KK ek KK Sk Kk KK KK RE KK RK KK RK KK ck ck ck ckck ck kc kck KKK KK AA AA RK A k k KK 20 30 PROGRAM NAME rs232exl txt 40 l 106 Chapter 2 Programming Examples RS 232 Programming Examples 50 PROGRAM DESCRIPTION This program verifies that the RS 232 connections and 60 interface are functional 70 l 80 Connect the UNIX workstation to the signal generator using an RS 232 cable 90 00 i 10 Run Agilent BASIC type in the following commands and then RUN the program 20 i 30 40 LK KK KK KK KK A KA KA AXA A KA KA Ck SK KK KA kk A KA KA kk A KA KA AXA KK kc kckckck kck ck AKA KK AKA ckck A k k ck kk 50 60 INTEGER Num 70 CONTROL 9 0 1 Resets the RS 232 interface 80 CONTROL 9 3 9600 Sets the baud rate to match the sig gen 90 STATUS 9 4 Stat Reads the value of register 4 200 Num BINAND Stat 7 Gets the AND value 210 CONTROL 9 4 Num S
162. pe ViSession variable ViUInt32 retCount Return count for string I O ViChar buffer MAX_COUNT Buffer for string I O status viOpenDefaultRM amp defaultRM Initialize the system Open communication with Serial Port 2 status viOpen defaultRM TPCIP0 19 INSTR VI NULL VI NULL amp instr if status If problems then prompt user printf Could not open ViSession Mn printf Check instruments and connections Mn printf Xn r exit 0 Set timeout for 5 seconds viSetAttribute instr VI ATTR TMO VALUE 5000 Ask for sig gen ID string status viWrite instr ViBuf IDN n 6 amp retCount Read the sig gen response status viRead instr ViBuf buffer MAX COUNT amp retCount buffer retCount 0 Indicate the end of the string printf Signal Generator ID Print header for ID printf buffer Print the ID string printf ntj Print carriage return Flush the read buffer Set sig gen power to 5dbm status viWrite instr ViBuf POW AMPL 5dbm n 15 amp retCount Query the power level status viWrite instr ViBuf POW n 5 amp retCount 72 Chapter 2 Programming Examples LAN Programming Examples Read the power level status viRead instr ViBuf buffer MAX COUNT amp retCount buffer retCount 0 Indicate the end of the string printf Power level Print header to the screen printf buffer Print the que
163. r MathCad can generate data which can be downloaded directly into PRAM in either a list format or a block format Direct downloads to PRAM allow complete control over bursting which is especially helpful for designing experimental or proprietary framing schemes The signal generator s baseband generator assembly builds modulation schemes by reading data stored in PRAM and constructing framing protocols according to the data patterns present PRAM data can be manipulated types of protocols changed standard protocols modified or customized etc using either the front panel interface or remote commands Preliminary Setup CAUTION Set up the digital communications format before downloading data This enables the signal generator to define the modulation format filter and data clock Activating the digital communications format after the data has been downloaded to PRAM can corrupt the downloaded data 182 Chapter 4 Downloading and Using Files Downloading Directly into Pattern RAM PRAM Data Requirements and Limitations 1 Data format List Format Because list format downloads are parsed before they are loaded into PRAM data must be 8 bit unsigned integers from 0 to 255 Block Format Because the baseband generator reads binary data from the data generator data must be in binary form 2 Total data bits plus control bits download size limitations are 32 megabytes with Option 002 and 64 megabytes with Option 602 Each sa
164. rcuit has been tripped There is no output in this state Any conditions that may have caused the problem should be corrected The RPP circuit can be reset by sending the remote SCPI command OUTput PROTection CLEar 1 Unleveled A 1 in this bit indicates that the output leveling loop is unable to set the output power 2 14 Unused These bits are always set to 0 15 Always 0 Query STATus QUEStionable PONer CONDition Response The decimal sum of the bits set to 1 Data Questionable Power Transition Filters negative and positive The Data Questionable Power Transition Filters specify which type of bit state changes in the condition register set corresponding bits in the event register Changes can be positive 0 to 1 or negative 1 to 0 Commands STATus QUEStionable POWer NTRansition value negative transition or STATus QUEStionable POWer PTRansition value positive transition where value is the sum of the decimal values of the bits you want to enable Queries STATus QUEStionable POWer NTRansition STATus QUEStionable POWer PTRansition Data Questionable Power Event Register The Data Questionable Power Event Register latches transition events from the condition register as specified by the transition filters Event registers are destructive read only reading data from an event register clears the contents of that register Query STATus QUEStiona
165. results into the argument list The conversion is done using conversion rules for the format string The parameter list includes the instrument address formatted data to read and so forth Using LAN The signal generator can be remotely programmed via a LAN interface and LAN connected computer using one of several LAN interface protocols The LAN allows instruments to be connected together and controlled by a LAN based computer LAN and its associated interface operations are defined in the IEEE 802 2 standard See the IEEE website for more details The signal generator supports the following LAN interface protocols e VXLII Sockets LAN Telephone Network TELNET e File Transfer Protocol FTP VXI 11 and sockets LAN are used for general programming using the LAN interface TELNET is used for interactive one command at a time instrument control and FTP is for file transfer 1 Selecting IO Libraries for LAN The TELNET and FTP protocols do not require IO libraries to be installed on your computer However to write programs to control your signal generator an I O library must be installed on your computer and the computer configured for instrument control using the LAN interface The IO libraries can be downloaded from the Agilent website The following is a discussion on these libraries Agilent VISA VISA is an IO library used to develop IO applications and instrument drivers that comply with industry standards Use the Agi
166. ried power level printf n y status viClose instr Close down the system status viClose defaultRM return 0 Sockets LAN Programming using C The program listing shown in Setting Parameters and Sending Queries Using Sockets and C on page 75 consists of two files lanio c and getopt c The lanio c file has two main functions int main andan int mainl The int main function allows communication with the signal generator interactively from the command line The program reads the signal generator s hostname from the command line followed by the SCPI command It then opens a socket to the signal generator using port 7777 and sends the command If the command appears to be a query the program queries the signal generator for a response and prints the response The int mainl after renaming to int main will output a sequence of commands to the signal generator You can use the format as a template and then add your own code This program is available on the PSG Documentation CD ROM as lanio c Sockets on UNIX In UNIX LAN communication via sockets is very similar to reading or writing a file The only difference is the openSocket routine which uses a few network library routines to create the TCP IP network connection Once this connection is created the standard fread and fwrite routines are used for network communication The following steps outline the process 1 Copy the lanio c and getopt
167. rigger the sweep AUTO n Sets mode for the list sweep 40 MHZ n Start frequency set to 40 MHz 900 MHZ n Stop frequency set to 900 MHz SWE POIN 25 n Set number of points for the step sweep SWE DWEL 5 S n Allow 5 sec dwell at each point INIT CONT OFF n Set up for single sweep TRIG SOUR IMM n Triggers the sweep INIT An Takes a single sweep While the instrument is sweeping have the program busy with printing to the display The Sleep function file windows h operation for while sweep 1 Printe WW Sleep 500 printf nT will defined in the header pause the program 5 seconds The following lines of code will stop the events and close down the session viStatus viDisableEvent vi VI_ALL_ENABLED_EVENTS VI_ALL_MECH viStatus viUninstallHandler vi VI_EVENT_SERVICE_REQ interupt viStatus viClose vi rdBuffer viStatus viClose defaultRM return 0 Chapter 2 63 Programming Examples GPIB Programming Examples The following function is called when an SRO event occurs Code specific to your requirements would be entered in the body of the function ViStatus _VI_FUNCH interupt ViSession vi ViEventType eventType ViEvent event ViAddr addr ViStatus status ViUIntl6 stb status viReadSTB vi amp stb Reads the Status Byte sweep 0 Sets the flag to stop the
168. rn used by the Status Byte Register A status group is a set of related registers whose contents are programmed to produce status summary bits In each status group corresponding bits in the condition register are filtered by the negative and positive transition filters and stored in the event register The contents of the event register are logically ANDed with the contents of the enable register and the result is logically ORed to produce a status summary bit in the Status Byte Register 126 Chapter 3 Programming the Status Register System Status Groups Standard Event Status Group The Standard Event Status Group is used to determine the specific event that set bit 5 in the Status Byte Register This group consists of the Standard Event Status Register an event register and the Standard Event Status Enable Register Chapter 3 Operation Complete Request Bus Control Query Error Device Dependent Error Execution Error Command Error User Request Power On OI Event Register 7 6 4 3 2 b3 TAE SEER 4 PPT 7 A S 8 LLT E Enable Register o 4 3 2 1 0 i j To Status Byte Register Bit 5 ck728a 127 Programming the Status Register System Status Groups Standard Event Status Register Table 3 4 Standard Event Status Register Bits Bit Description 0 Operation Complete A 1 in this bit position indicates that all pending signal generator operations were compl
169. rs 15 25 ESE commands 121 event enable register description 126 event registers description 126 examples ARB waveforms generating and downloading 157 loading and playing 170 using Matlab 157 binary directory downloading to 177 bit directory downloading to 176 FIR filter coefficients downloading 180 Java 103 pass thru commands 65 PRAM downloads 184 185 system requirements C C 28 user files as transmitted data 178 extracting waveforms 172 173 F files downloading 151 encryption 172 error messages 25 headers 172 including 29 transferring 20 filters See also transition filters negative transition description 126 positive transition description 126 FIR filter coefficients downloading 179 firmware status monitoring 118 FTP 20 function statements 8 G GPIB address 6 cables 7 configuration 6 controller 7 function statements 8 interface card PC 4 5 interface card installing 4 interface description 3 IO libraries 6 listener 7 on UNIX 5 program examples 30 talker 7 using 4 verifying operation 7 H hardware status monitoring 118 headers 172 hostname 12 HyperTerminal 24 iabort 8 ibloc 10 ibstop 8 ibwrt 11 iclear 10 IEEE 488 2 common commands 121 IEEE website 4 igpibllo 9 instrument status monitoring 114 interface card GPIB PC 5 Agilent GPIB interface card 4 interfaces computer 3 IO libraries 2 3 6 22 IP addr
170. s E8254A SN US0000000 4 220 Firmware Mar 28 2001 11 23 18 220 Hostname 0001p1 220 IP 000 000 00 000 220 FTP server lt Version 1 0 gt ready User lt 000 000 00 000 lt none gt gt 331 Password required Password 230 Successful login ftp gt Is 200 Port command successful 150 Opening data connection BACKUP BIN CAL HTML SYS USER 226 Transfer complete 35 bytes received in 0 00 seconds lt 35000 00 Kbytes sec gt ftp gt _ ce917a The following steps outline a sample FTP session from the MS DOS Command Prompt 1 2 On the PC click Start gt Programs gt Command Prompt At the command prompt enter ftp IP address gt or lt hostname gt At the user name prompt press enter At the password prompt press enter You are now in the signal generator s user directory Typing help at the command prompt will show you the FTP commands that are available on your system Type quit or bye to end your FTP session Type exit to end the command prompt session Chapter 1 21 Getting Started Using RS 232 Using RS 232 The RS 232 serial interface can be used to communicate with the signal generator The RS 232 connection is standard on most PCs and can be connected to the signal generator s rear panel AUXILIARY INTERFACE connector using the cable described in Table 1 6 on page 23 Many functions provided by GPIB with the exception of indefinite blocks serial polling GET non SCPI remote
171. s ede ERE WR CUT doe be dE Rid x de od 12 3 Vet VINS LAN PheHONAllly 2 45 15406 xac RR eot here RR EE RR a E el DEAR OER 14 Maing MAH z pc ecibs he oboe dies Shoot nied LU ES beste debatedeneteioces ees 16 Lise SCCL eie eeepc mbsmi ics oi cie Eq bid esq edd 17 Using TELNET LSN eoserrsogess ais give ee bes E EEIE EREDE ERSEK E ERE Nep 17 Lang FIP Luinosqacee Re OEC HI HP E CR EC RC E CER CEP LPR ERR RR PRED be dodo 20 UunsBcuE olcsesawesequwR queas eR ES Ee ETC VR Le RE DE CA ERR GEC RD SS pais 22 I Selecting IO Libraues for RS 232 o eg ic RI ene RR RE HE A ENG E EE RR EROR REC On 22 2 Semne Up the R3 2 3 WANG ss eta mia eens mb E RUE RH RRE debet een pats 23 a Ver bying RS 232 Pusthionablty usen pRREAREREREA UP ERTILRPRAXURERREKRU REED C RE RR 24 Character Font stanicters od e reb eblguecsad onde bed dide d 24 It You Have PIODISIUS ia eoiesd ce Re et doj PR eset rt DER ESCRRGAR E ROO d RR do Redes 25 cedro P rrmmP 29 Eror Message Pe 116s queso bere wwteev c esset od E IRE ETE Re e qe ga 23 Bor Message BS crea apps renTo EEES Cep Sa ESE PRO GE RE GE PS SO PES ESE ESE ES 26 2 Programming ERO iii z k duco bebe dor dac doe elei elo e olor disk Using ihe Programming BEAR 350 cow dae cane cea ICE dane RR RE RUR RS RR KE een 28 Programming Examples Development Environment 0 0 00 eee 28 Runung C C 4 Programming Examples 2500 4ecc0 e eee kdy Bb kk dees d asd 29 GPIB Programme Bxamples eco cuo qiact
172. s to which it pertains Should Agilent have a written contract with the User and should any of the contract terms conflict with these terms the contract terms shall control Questions or Comments about our Documentation We welcome any questions or comments you may have about our documentation Please send us an E mail at sources manuals am exch agilent com Contents 1 Betting Startadl drama isanaanstaasdaamdnamamandn nins sis ernesenestacewnase ssens D Inbioduction to Remme Der ON cero satis gas eee B R BOB d ESIE EESE PERSE YE agp ud 2 Inietfaces ons coa dicke DER EROS EEeI EES PEPE pas GEiEG para ARR gu E 3 I oy il o P o er db d RET FEDERN bd ee eg dq d 3 Popron IL AAS pode od dd mass mica is o k RC o 4 MEMO lt i pecan SE IES PEE CEEC Mamie dopor ka EE RES ride pi a kokr a G dano ae seda 4 1 Installing the GPIB Interface C and sz uau babka k d djd ka babe k kr EEEO EERDE TEORI 4 2 5elecung Ib Linranes tor GPIB 4 ET 6 3 Setting Up the GPIB Intetldee iz zia4w eds ee sons bow dk dob UO e o Rb Re SR ties s 6 4 Venityinp GPIB Funcnonalty z pidi dy bd did py dk K EB AE V Seo SSE tikeh ES 7 GFE Tope ERO US TOES aides edi eee RA qu E RA Ur Oque Sed pee ee ee eed 6 og i dedii 7 GPIB Funcion SENEN vs eode es Er R ARR R EER A EE ES Apnd Sub gor ots 8 DESEE ON oients dette bbs b bibebb ri eee RE RE EERON RE RERE 12 1 Selecang IO Libtaries fot LAN sz zu ed jod E aoe ERE POSER P STE Yes 12 2 Denn Up the LAN METIE od end
173. s using the SCPI remote interface error queue the error numbers and the error description portions of the error query response are displayed on the host terminal Characteristic SCPI Remote Interface Error Queue Capacity errors 30 Overflow Handling Linear first in first out Replaces newest error with 350 Queue overflow Viewing Entries Use SCPI query SYSTem ERRor NEXT 2 Clearing the Queue Power up Send a CLS command Read last item in the queue Unresolved Errors Re reported after queue is cleared No Errors When the queue is empty every error in the queue has been read or the queue is cleared the following message appears in the queue 0 No error Errors that must be resolved For example unlock Error Message File A complete list of error messages is provided in the file errormesages pdf on the CD ROM supplied with your instrument In the error message list an explanation is generally included with each error to further clarify its meaning The error messages are listed numerically In cases where there are multiple listings for the same error number the messages are in alphabetical order Chapter 1 25 Getting Started Error Messages Error Message Types Events do not generate more than one type of error For example an event that generates a query error will not generate a device specific execution or command error Query Err
174. signal generator is a C 480 PRINT 490 The next command is a query for the signal generator s GPIB address 500 OUTPUT Sig gen SYST COMM GPIB ADDR 510 ENTER Sig_gen D Enter in the signal generator s address 520 Print the signal generator s GPIB address to the controllers display 530 PRINT The GPIB address is D 540 PRINT 550 Print user prompts to the controller s display 560 PRINT The signal generator is now under local control 570 PRINT or Press RUN to start again 580 END Queries Using NI 488 2 and C This example uses the NI 488 2 library to query different instrument states and conditions Launch Microsoft Visual C 6 0 add the required files and enter the following code into your cpp source file The following program example is available on the PSG Documentation CD ROM as niex3 cpp J RR RRR KK KKK k k k k k k k k KK k k k k k k k KKK k k k EE k k k k k k k k k k k k k k k RE k k k k k kk k k k k k kk k kk k I kk k HK PROGRAM NAME niex3 cpp PROGRAM DESCRIPTION This example demonstrates the use of query commands The signal generator can be queried for conditions and instrument states These commands are of the type IDN where the question mark indicates Chapter 2 39 Programming Examples GPIB Programming Examples a query KEK K KKK KKK A KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK ck ck ck KKK KKK KKK RR RR RX X
175. sing VISA and C This example uses VISA library functions to query different instrument states and conditions Launch Microsoft Visual C 6 0 add the required files and enter the following code into your cpp source file The following program example is available on the PSG Documentation CD ROM as visaex3 cpp J BR KK KR KK IK KK IK RIK I RR oko k kok k oko ko oko oko k kok k k kok k kok kok kok k k kok kok kok k k kok k kok k kok k kok k k EE XX ke e PROGRAM FILE NAME visaex3 cpp PROGRAM DESCRIPTION This example demonstrates the use of query commands The signal generator can be queried for conditions and instrument states These commands are of the type IDN the question mark indicates a query J RR RRR kok ok KR KKK IKK KK KKK KKK KK I RR EE RR EE RE IKK A k k k k k k IRR IR kk k k k k II k k RR I k k XX k k include lt visa h gt include StdAfx h include lt iostream gt include lt conio h gt include lt stdlib h gt using namespace std void main ViSession defaultRM vi Declares variables of type ViSession for instrument communication ViStatus viStatus 0 Declares a variable of type ViStatus for GPIB verifications char rdBuffer 256 Declares variable to hold string data 42 Chapter 2 Programming Examples GPIB Programming Examples int num Declares variable to hold integer data Initialize the VISA system viStatus viOpenDefaultRM amp defaultRM
176. sion vi ViEventType eventType ViEvent event addr int main ViSession defaultRM vi Declares variables of type ViSession for instrument communication ViStatus viStatus 0 Declares a variable of type ViStatus for GPIB verifications char rdBuffer MAX_CNT Declare a block of memory data viStatus viOpenDefaultRM amp defaultRM Initialize VISA session if viStatus lt VI SUCCESS If problems then prompt user printf ERROR initializing VISA exiting n printf n return 1 Open session to gpib device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI NULL VI NULL amp vi if viStatus If problems then prompt user printf ERROR Could not open communication with instrument Wn printf nny return 1 Chapter 2 ViAddr 61 Programming Examples GPIB Programming Examples viClear vi Clears the signal generator viPrintf vi RST n Resets signal generator Print program header and information printf End of Sweep Service Request n printf tint printf The signal generator will be set up for a step sweep mode operation n printf An will be printed while the instrument is sweeping The end of n printf sweep will be indicated by an SRQ on the GPIB and the program will end n Serine ntj printf Press Enter to continue n printf Nn getch viPrintf vi CLS n Clears signal generator status by
177. standard sockets APIs The signal generator can be controlled using SCPI commands that are output to a socket connection established in your program Before you can use sockets LAN you must select the signal generator s sockets port number to use Standard mode Available on port 5025 Use this port for simple programming e TELNET mode The telnet SCPI service is available on port 5023 NOTE The signal generator will accept references to telnet SCPI service at port 7777 and sockets SCPI service at port 7778 An example using sockets LAN is given in Chapter 2 of this programming guide Using TELNET LAN TELNET provides a means of communicating with the signal generator over the LAN The TELNET client run on a LAN connected computer will create a login session on the signal generator A connection established between computer and signal generator generates a user interface display screen with SCPI gt prompts on the command line Using the TELNET protocol to send commands to the signal generator is similar to communicating with the signal generator over GPIB You establish a connection with the signal generator and then send or receive information using SCPI commands Communication is interactive one command at a time Using TELNET and MS DOS Command Prompt 1 On the PC click Start gt Programs gt Command Prompt 2 At the command prompt type in telnet Chapter 1 17 Getting Started Using LAN 3 Press enter The TELNET
178. ster The Data Questionable Condition Register continuously monitors the hardware and firmware status of the signal generator condition registers are read only Table 3 7 Data Questionable Condition Register Bits Bit Description 0 1 2 Unused These bits are always set to 0 3 Power summary This is a summary bit taken from the QUEStionable POWer register A 1 in this bit position indicates that one of the following may have happened the ALC Automatic Leveling Control is unable to maintain a leveled RF output power i e ALC is UNLEVELED the reverse power protection circuit has been tripped See the Data Questionable Power Status Group on page 138 for more information 4 Temperature OVEN COLD A 1 in this bit position indicates that the internal reference oscillator reference oven is cold 5 Frequency summary This is a summary bit taken from the QUEStionable FREQuency register A 1 in this bit position indicates that one of the following may have happened synthesizer PLL unlocked 10 MHz reference VCO PLL unlocked 1 GHz reference unlocked sampler YO loop unlocked or baseband 1 unlocked For more information see the Data Questionable Frequency Status Group on page 141 6 Unused This bit is always set to 0 7 Modulation summary This is a summary bit taken from the QUEStionable MODulation register A in this bit position indicates that one of the following may have happened modulation
179. ster is read You will be asked to set up the signal generator for error generating conditions The data questionable status register will be read and the program will notify the user of the error condition that the setup caused Follow the user prompts presented when the program runs Launch Microsoft Visual C 6 0 add the required files and enter the following Chapter 2 55 Programming Examples GPIB Programming Examples code into your cpp source file The following program example is available on the PSG Documentation CD ROM as visaex9 cpp J RR RRR RRR KR KKK IKK IKK KKK IKK IK KKK k k k IK KKK k k k k k k k k k k RE EE RR k k RE RR k k kk k kk II k kk k k PROGRAM NAME visaex9 cpp PROGRAM DESCRIPTION In this example the data questionable status register is read The data questionable status register is enabled to read an unleveled condition The signal generator is then set up for an unleveled condition and the data questionable status register read The results are then displayed to the user The status questionable register is then setup to monitor a modulation error condition The signal generator is set up for a modulation error condition and the data questionable status register is read The results are displayed to the active window J BR KK kok KK KKK IKK RR kok oko k kok k kok kok kok k k ERROR RE k k k k k k k k k k k k k kk k k k IR kk k k k k kok kok EE RX k include lt vis
180. t ifndef _WINSOCKAPI_ include lt winsock h gt BSD style socket functions endif else UNIX with BSD sockets include lt sys socket h gt for connect and socket include lt netinet in h gt for sockaddr_in include lt netdb h gt for gethostbyname ial A define SOCKET_ERROR 1 define INVALID SOCKET 1 typedef int SOCKET 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 optstring else include lt unistd h gt for getopt 3C endif define COMMAND ERROR 1 define NO CMD ERROR 0 78 Chapter 2 Programming Examples LAN Programming Examples define SCPI PORT 7777 define INPUT BUF SIZE 64 1024 RRR KK RR RR RE I KK kk Ck Ck Kk Ck Kk Ck kk k kok k kok Kk Ck k k kok k kok kok kok k k ke kk k k k k ko ke RX RE k k k kk Display usage A static void usage char basename fprintf stderr Usage s nqu hostname lt command gt n basename fprintf stderr s nqu hostname stdin n basename fprintf stderr n number output lines n fprintf stderr Q quiet do NOT echo lines n fprintf stderr e show messages in error queue when done n ifdef WINSOCK int init_winsock void WORD wVersionRequested WSADATA wsaData int err wVersionRequested MAKEWORD 1
181. te viPrintf vi STAT OPER NTR 8 n Sets the Operation Status Group Negative Transition Filter to indicate a negative transition in Bit 3 Sweeping which will set a corresponding event in the Operation Event Register This occurs the end of a sweep viPrintf vi STAT OPER PTR 0Xn Sets the Operation Status Group Positive Transition Filter so that no positive transition on Bit 3 affects the Operation Event Register The positive transition occurs at the start of a sweep viPrintf vi STAT OPER ENAB 8 n Enables Operation Status Event Bit 3 to report the event to Status Byte Register Summary Bit 7 viPrintf vi SRE 128 n Enables Status Byte Register Summary Bit 7 The next line of code indicates the function to call on an event viStatus vilnstallHandler vi VI EVENT SERVICE REQ interupt rdBuffer The next line of code enables the detection of an event viStatus viEnableEvent vi VI EVENT SERVICE REO VI HNDLR VI NULL viPrintf vi FREQ MODE LIST n Sets frequency mode to list 62 Chapter 2 viPrintf vi viPrintf vi viPrintf vi viPrintf vi viPrintf vi viPrintf vi viPrintf vi viPrintf vi viPrintf vi viPrintf vi Printe n s LIST LIST LIST FREO FREO TYPE TRIG MODE STAR STOP Programming Examples GPIB Programming Examples STEP n Sets sweep to step SOUR IMM n Immediately t
182. ter Pass Thru 17 The pass thru address is automatically selected by the 8757D by inverting the last bit of the 8757D address Refer to the 8757D documentation for more information Verify that no other instrument is using this address on the GPIB bus Example Pass Thru Program Example 2 1 on page 67 is a sample Agilent BASIC program that switches the 8757D to pass thru mode allowing you to send operating commands to the PSG After the program runs control is given back to the network analyzer The following describes the command lines used in the program Line 30 PT is set to equal the source address C1 is added but not needed to specify the channel Lines 40 90 The END statement is required to complete the language transition Lines 50 100 A WAIT statement is recommended after a language change to allow all instrument changes to be completed before the next command Lines 70 80 This is added to ensure that the instrument has completed all operations before switching languages Line 110 This takes the network analyzer out of pass thru command mode and puts it back in control Any analyzer command can now be entered 66 Chapter 2 Programming Examples GPIB Programming Examples Example 2 1 Pass Thru Program 10 ABORT 7 20 CLEAR 716 30 OUTPUT 716 PT19 C1 40 OUTPUT 717 SYST LANG SCPI END W 50 WAIT 5 60 OUTPUT 717 PON STAT OFF 80 ENTER 717 Reply O 70 OUTPUT 717
183. the Carrier After downloading a file 1 Set the carrier frequency Set the carrier amplitude Turn on modulation PO R Turn on the RF output Viewing a PRAM Waveform After the waveform data is written to PRAM the data pattern can be viewed using an oscilloscope There is delay approximately 12 symbols between a state change in the burst bit and the corresponding effect at the RF out This delay varies with symbol rate and filter settings and reguires compensation to advance the burst bit in the downloaded PRAM file Troubleshooting Direct PRAM Download Problems Symptom Possible Cause The transmitted pattern is Pattern reset bit not set interspersed with random unwanted data Ensure that the pattern reset bit bit 7 value 128 is set on the last byte of your downloaded data ERROR 223 Too much data PRAM download exceeds the size of PRAM memory Either use a smaller pattern or get more memory by ordering the appropriate hardware option NOTE Review Data Requirements and Limitations on page 183 186 Chapter 4 Numerics 8757D pass thru commands using 65 A abort function 8 address GPIB address 6 IP address 12 Agilent BASIC 31 SICL 30 VISA 6 12 22 30 ARB waveform data downloading 153 ARB waveform file downloads 172 173 example programs 157 166 ARB waveform files composition 172 encryption 172 extracting 173 headers 172 use in other PSGs 173 ascii
184. tion Failure Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Unused Always Zero 0 Data QUEStionable CALibrati Condition Register 15 14 18 12 1110987654 3210 Data QUEStionable y v t i t itti tt ii CALibration Positive 15 14 13 12 11109 8 7 6 5 4 32 1 O Transition Filter Data QUEStionable yx Y Y Y Y Yv Y Y Y Y V Y rn 15 14 13 12 11 100987 6543210 egative Transition Filter mm X Y X Y Y Y Y Y Y Y Y v Y S Event Register N AN amp AN amp ID LS 4 Data QUES tionable EE DOE 2 ipbration Event 15 14 18 12 11 109 87 654 3 21 0 Enable Register To Data Questionable Status Register Bit 8 ck720a Chapter 3 147 Programming the Status Register System Status Groups Data Questionable Calibration Condition Register The Data Questionable Calibration Condition Register continuously monitors the calibration status of the signal generator condition registers are read only Table 3 11 Data Questionable Calibration Condition Register Bits Bit Description 0 DCFM DC2M Zero Failure A 1 in this bit indicates that the DCFM DC M zero calibration routine has failed This is a critical error The output of the source is not valid until the condition of this bit is 0 1 I Q Calibration Failure A 1 in this bit indicates that the I Q modulation calibration experienced a failure 2 14 Unused These bits are always set to
185. tus Register Information Table 3 2 Effects of STATus PRESet Register Value after STATus PRESet STATus OPERation ENABle 0 STATus OPERation NTRansition 0 STATus OPERation PTRransition 32767 STATus OPERation B ASeband ENABle 0 STATus OPERation B ASeband NTRansition 0 STATus OPERation B ASeband PTRransition 32167 STATus QUEStionable CALibration ENA Ble 32767 STATus QUEStionable CALibration NTRansition 32767 STATus QUEStionable CALibration PTRansition 32767 STATus QUEStionable ENABle 0 STATus QUEStionable NTRansition 0 STATus QUEStionable PTRansition 32767 STATus QUEStionable FREQuency ENABle 32767 STATus QUEStionable FREQuency NTRansition 32767 STATus QUEStionable FREQuency PTRansition 32767 STATus QUEStionable MODulation ENABle 32767 STATus QUEStionable MODulation NTRansition 32767 STATus QUEStionable MODulation PTRansition 32767 STATus QUEStionable POWer ENABle 32767 STATus QUEStionable POWer NTRansition 32767 STATus QUEStionable POWer PTRansition 32767 STATus QUEStionable BERT ENABle 32767 STATus QUEStionable BERT NTRansition 32767 STATus QUEStionable BERT PTRansition 32767 122 Chapter 3 Programming the Status Register System Status Byte Group Status Byte Group The Status Byte Group includes the Status Byte Register and the Service Request Enable Register Status Byte Register T 8 Tele f
186. up on page 132 for more information 11 Sweep Calculating A 1 in this bit position indicates that the signal generator is currently doing the necessary pre sweep calculations 12 13 14 Unused These bits are always set to 0 15 Always 0 Query STATus OPERation CONDition Response The decimal sum of the bits that are set to 1 Example The decimal value 520 is returned The decimal sum 512 bit 9 8 bit 3 Standard Operation Transition Filters negative and positive The Standard Operation Transition Filters specify which types of bit state changes in the condition register 130 Chapter 3 Programming the Status Register System Status Groups set corresponding bits in the event register Changes can be positive 0 to 1 or negative 1 to 0 Commands Queries STATus OPI ERation NI STATus OPI lt value gt is ERation P1 the sum of th n ATus OPI ERation NI STATus OPI Standard Operation Event Register ERation P1 TRansition value negative transition or Ransition value positive transition where e decimal values of the bits you want to enable TRansition Ransition The Standard Operation Event Register latches transition events from the condition register as specified by the transition filters Event registers are destructive read only reading data from an event register clears the content of that register Ouery STATus OPER
187. ups Status Groups The Standard Operation Status Group and the Data Questionable Status Group consist of the registers listed below The Standard Event Status Group is similar but does not have negative or positive transition filters or a condition register Condition Register Negative Transition Filter Positive Transition Filter Event Register Event Enable Register A condition register continuously monitors the hardware and firmware status of the signal generator There is no latching or buffering for a condition register it is updated in real time A negative transition filter specifies the bits in the condition register that will set corresponding bits in the event register when the condition bit changes from to 0 A positive transition filter specifies the bits in the condition register that will set corresponding bits in the event register when the condition bit changes from 0 to 1 An event register latches transition events from the condition register as specified by the positive and negative transition filters Once the bits in the event register are set they remain set until cleared by either querying the register contents or sending the CLS command An enable register specifies the bits in the event register that generate the summary bit The signal generator logically ANDs corresponding bits in the event and enable registers and ORs all the resulting bits to produce a summary bit Summary bits are in tu
188. ur computer to verify the RS 232 interface functionality To run the HyperTerminal program connect the RS 232 cable between the computer and the signal generator and perform the following steps 1 On the PC click Start gt Programs gt Accessories gt HyperTerminal and select HyperTerminal 2 Enter a name for the session in the text box and select an icon 3 Select COMI COM can be used if COMI is unavailable and set the following parameters Bits per second 9600 must match signal generator s baud rate on the signal generator Select Utility gt GPIB RS 232 LAN gt RS 232 Setup gt RS 232 Baud Rate gt 9600 e Data bits 8 e Parity None e Stop bits I e Flow Control None NOTE Flow control via the RTS line is driven by the signal generator For the purposes of this verification the controller PC can ignore this if flow control is set to None However to control the signal generator programatically or download files to the signal generator you must enable RTS CTS hardware flow control on the controller Note that only the RTS line is currently used Go to the HyperTerminal window and select File Properties Go to Settings gt Emulation and select VT100 Leave the Backscroll buffer lines set to the default value Go to Settings gt ASCII Setup Check the first two boxes and leave the other boxes as default values 9o M o tan Once the connection is established enter the SCPI command IDN followed by Ctr
189. ut Using NI 488 2 and C on page 36 e Queries Using Agilent BASIC on page 37 Queries Using NI 488 2 and C on page 39 e Queries Using VISA and C on page 42 Generating a CW Signal Using VISA and C on page 44 e Generating an Externally Applied AC Coupled FM Signal Using VISA and C on page 46 e Generating an Internal AC Coupled FM Signal Using VISA and C on page 49 e Generating a Step Swept Signal Using VISA and C on page 51 e Saving and Recalling States Using VISA and C on page 52 Reading the Data Questionable Status Register Using VISA and C on page 55 Reading the Service Request Interrupt SRQ Using VISA and C on page 60 e Using 8757D Pass Thru Commands on page 65 Before Using the Examples If the Agilent GPIB interface card is used then the Agilent VISA library should be installed along with Agilent SICL If the National Instruments PCI GPIB interface card is used the NI VISA library along with the NI 488 2 library should be installed Refer to 2 Selecting IO Libraries for GPIB on page 6 and the documentation for your GPIB interface card for details NOTE Agilent BASIC addresses the signal generator at 719 The GPIB card is addressed at 7 and the signal generator at 19 The GPIB address designator for other libraries is typically GPIBO or GPIBI 30 Chapter 2 Programming Examples GPIB Programming Examples Interface Check using Agilent BASIC This simple program causes the sign
190. uter and signal generator An IO library is a collection of functions used by a programming language to send instrument commands An IO library must be installed on your computer before writing any programs to control the signal generator NOTE Chapter 1 Agilent IO libraries support the VXI 11 standard Getting Started Using GPIB Programming Language The programming language is used along with Standard Commands for Programming Instructions SCPI and IO library functions to remotely control the signal generator Common programming languages include e C C e LabView e Agilent BASIC e Java Using GPIB The GPIB allows instruments to be connected together and controlled by a computer The GPIB and its associated interface operations are defined in the ANSI IEEE Standard 488 1 1987 and ANSI IEEE Standard 488 2 1992 See the IEEE website www ieee org for details on these standards 1 Installing the GPIB Interface Card A GPIB interface card must be installed in your computer Two common GPIB interface cards are the National Instruments NI PCI GPIB and the Agilent GPIB interface cards Follow the GPIB interface card instructions for installing and configuring the card in your computer The following tables provide information on interface cards Table 1 1 Agilent GPIB Interface Card for PC Based Systems Interface Operating IO Library Languages Backplane B Max I0 Buffering Card System US kB sec Agilent Windows
191. while chr getopt argc argv qune EOF switch chr case q quiet 1 break case n number 1 break case e show errs 1 break case u case usage basename exit 1 now look for hostname and optional lt command gt if optind argc destination argv optind 92 Chapter 2 Programming Examples LAN Programming Examples strcpy command if optind lt argc while optind lt argc lt hostname gt lt command gt provided only one command string strcat command argv optind if optind lt argc streat command else strcat command n else Only lt hostname gt provided input on lt stdin gt strcpy command if optind gt argc usage basename exit 1 else no hostname usage basename exit 1 Chapter 2 93 Programming Examples LAN Programming Examples RRR KK RK KKK IKK k k k KKK IK oko kok k k k k k k k k oko kok k k k k k k k k open a socket connection to the instrument RRR KK KKK KKK IK RE I KK RR EE RE KKK IKK RK KK KK ifdef WINSOCK if init winsock 0 exit 1 endif WINSOCK instSock openSocket destination SCPI PORT if instSock INVALID_SOCKET fprintf stderr Unable to open socket n return 1 fprintf stderr Socket opened n if strlen command gt 0 ROR KR KR k k k k k kk k k k k k k
192. xtracted from the PSG in unencrypted form Furthermore files created with prior PSG firmware revisions cannot be extracted in any form Downloading waveform data to the PSG for extraction as an encrypted waveform file If you are using waveform data created in MATLAB or another similar application and are using SCPI to download the data to the PSG you must use the MMEM DATA UNPRotected command Downloading data with this command allows it to be extracted from the PSG s SECUREWAVE directory as an encrypted file refer to Extracting waveform files from the PSG for use in other PSGs on page 173 If you use FTP no special command syntax is necessary Table 4 1 shows the command syntax options for both methods Table 4 1 Download Method Memory Type Command Syntax Options SCPI volatile memory MMEM DATA UNPRotected user bbg 1 waveform filename lt blockdata gt MMEM DATA UNPRotected VVFM 1 filename lt blockdata gt MMEM DATA UNPRotected filename WFM1 SCPI non volatile memory MMEM DATA UNPRotected user waveform filename lt blockdata gt MMEM DATA UNPRotected NVWFM filename blockdata MMEM DATA UNPRotected filename NVWFM FTP volatile memory put filename user bbg1 waveform newfilename FTP non volatile memory put filename user waveform newfilename 172 Chapter 4 Downloading and Using Files Understanding ARB Waveform File Composition and Encryption Extracting waveform files from the P
193. y Via the remote interface send the following SCPI commands MEMory COPY NAME lt NVWFM file name gt lt WFM1 file_name gt Because copying a waveform file from volatile to non volatile memory also copies the associated marker file it is not necessary to sent a separate command to copy the marker file 2 Select the downloaded waveform file in volatile waveform memory for playback Via the front panel Press Mode gt Dual ARB gt Select Waveform gt Select Waveform Via the remote interface SOURce RADio ARB WAVeform WFM1 lt file_ name gt 3 Play the waveform and use it to modulate the RF carrier Via the front panel Turn on ARB Off On then turn on both modulation and the RF output 170 Chapter 4 Downloading and Using Files Downloading ARB Waveform Data Via the remote interface send the following SCPI commands SOURce RADio ARB STATe ON OUTPut MODulation STATe ON OUTPut STATe ON Troubleshooting ARB Waveform Data Download Problems Symptom Possible Cause ERROR 224 Text file busy Attempting to download a waveform that has the same name as the waveform currently being played by the signal generator Either change the name of the downloaded waveform or turn off the ARB ERROR 321 Out of memory There is not enough space in the ARB memory for the waveform file being downloaded Either reduce the file size of the waveform file or delete unnecessary files
194. ytes lt numBytes BOR K K k KKK IK KR k k k KKK IK RE k k k k k k k Kk k k k k k Kk EE k k RE RX ko OK For LAN dumps there is always an extra trailing newline Since there is no EOI line For ASCII dumps this is Chapter 2 87 Programming Examples LAN Programming Examples great but for binary dumps it is not needed RX RX XXX KR kk k kok XX Fe XXX RE k kok k kk k kk k k k kk XX EX kk k A ke ke ke if resultBytes numBytes char junk count recv sock amp junk 1 0 else indefinite block dump til we can an extra line feed do if recv_line sock result maxLength NULL break if strlen result 1 amp amp result n break resultBytes strlen result result strlen result while 1 else ASCII response not a binary block result char ch if recv line sock result 1 maxLength 1 NULL return 0 REMOVE trailing newline if present And terminate string resultBytes strlen result if result resultBytes 1 n resultBytes 1 result resultBytes 0 while 0 88 Chapter 2 Programming Examples LAN Programming Examples return resultBytes RRR KK KK KR KKK RR EE o EE KK RR k k RR IK I RR EE RR k k k k k k k k k k k k k k k k k k k k KK k k k OK V Function showErrors Description Query the SCPI error queue until empty Print results SReturn void OK CKCKCKCkCk Kk Ck Ck Kk
195. z Reference Unlocked 1 GHz Reference Unlocked Baseband 1 Unlocked Unused Sampler Loop Unlocked YO Loop Unlocked Unused Unused Unused Unused Unused Unused Unused Unused Always Zero 0 Data QUEStionabl FREQuency Condition Registe Data QUEStionabl FREQuency Positive Transition Filter Data QUEStionabl FREQuency Negative Transition Filter e e Y Y V Y Y VY Y Y Y Y Y Y Y Y y QVE EY Y vi vvv vt vv vs Y Vt t evi vtt v Y vv Data QUEStionabl FREQuency Event Register Data QUEStionabl FREQuency Event Enable Register 3 La EHE POY i 115 14 13 12 1110987654321 O L FO amp mmm bM DA mn a I 4 ee Pe ee 15 14 13 12 11 10 98 7 65 4 3 2 1 0 To Data Questionable Status Register Bit 5 ch 7064 Chapter 3 141 Programming the Status Register System Status Groups Data Questionable Frequency Condition Register The Data Questionable Frequency Condition Register continuously monitors the hardware and firmware status of the signal generator condition registers are read only Table 3 9 Data Questionable Frequency Condition Register Bits Bit Description 0 Synth Unlocked A 1 in this bit indicates that the synthesizer is unlocked 1 10 MHz Ref Unlocked A 1 in this bit indicates that the 10 MHz reference signal is unlocked 2 1 Ghz Ref Unlocked A 1 in this bit indicates that the 1 Ghz reference signal is unlocked 3 B
196. z n Wait for completion print Waiting for source to settle n print sock opce n my response lt sock gt chomp response Removes newline from response if Sresponse ne 1 die Bad response to OPC from instrument n 102 Chapter 2 Programming Examples LAN Programming Examples Send identification query print sock IDN n Sresponse lt Ssock gt chomp response print Instrument ID responseln Sockets LAN Programming Using J ava In this example the Java program connects to the signal generator via sockets LAN This program requires Java version 1 1 or later be installed on your PC To run the program perform the following steps 1 In the code example below type in the hostname or IP address of your signal generator For example String instrumentName your signal generator s hostname 2 Copy the program as ScpiSockTest java and save it in a convenient directory on your computer For example save the file to the C jdk1 3 0_2 bin Jjavac directory 3 Launch the Command Prompt program on your computer Click Start gt Programs gt Command Prompt 4 Compile the program At the command prompt type javac ScpiSockTest java The directory path for the Java compiler must be specified For example C gt jdk1 3 0_2 bin javac ScpiSockTest java 5 Run the program by typing java ScpiSockTest at the command prompt 6 Type exit at the command prompt to end the progr

Download Pdf Manuals

image

Related Search

Related Contents

  Manual - Meco Instruments P.Ltd  取扱説明書 - 株式会社メイコーテック  uchie    *48004410* 48004410 RESOL FAP13  “Axxon Smart”  Extron electronic 222S User's Manual  BKPool 800 - Heat Pipe Technology, Inc.  

Copyright © All rights reserved.
Failed to retrieve file