background image

382                                             Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide

Creating and Downloading User–Data Files
User Flatness Correction Downloads Using C++ and VISA

        //will hold the frequency and amplitude arrays

        char** pairsList = new char* [lenArray]; //pointer array

        for (int n=0; n < lenArray; n++)//initialize the pairsList 
array 

                                       //pairsList[n]=0;

        for (int i=0; i < num; i++)

        {

          char* nextFreq = new char[MAX_STRING1]; 
//frequency array

          char* nextPower = new 
char[MAX_STRING1];//amplitude array

          //enter frequency and amplitude pairs i.e 10ghz .1db

          printf("Enter Freq %d: ", i+1); 

          scanf("%s", nextFreq);

          printf("Enter Power %d: ",i+1);

          scanf("%s", nextPower);

          pairsList[2*i] = nextFreq;//frequency  

          pairsList[2*i+1]=nextPower;//power correction

        }

 

    unsigned char str[256];//buffer used to hold SCPI command

    //initialize the signal generator's user flatness table

    sprintf((char*)str,":corr:flat:pres\n"); //write to buffer

    viWrite(vi, str,strlen((char*str),0);    //write to PSG

    char c = ',';//comma separator for SCPI command

    for (int j=0; j< num; j++)   //download pairs to the PSG

      {

       sprintf((char*)str,":corr:flat:pair %s %c 
%s\n",pairsList[2*j], c,               pairsList[2*j+1]); // << on 
SAME line!

       viWrite(vi, str,strlen((char*)str),0);

     }

Содержание X-Series

Страница 1: ...Programming Guide Keysight N5166B CXG N5171B 72B 73B EXG N5181B 82B 83B MXG X Series Signal Generators ...

Страница 2: ... Software to U S government customers under its standard commercial license which is embodied in its End User License Agreement EULA a copy of which can be found at http www keysight com find sweula The license set forth in the EULA represents the exclusive authority by which the U S government may use modify distribute or disclose the Software The EULA and the license set forth therein does not r...

Страница 3: ...To receive the latest updates by email subscribe to Keysight Email Updates at the following URL http www keysight com find MyKeysight Information on preventing instrument damage can be found at www keysight com find PreventingInstrumentRepair Is your product software up to date Periodically Keysight releases software updates to fix known defects and incorporate product enhancements To search for s...

Страница 4: ...4 ...

Страница 5: ...aying the LAN Configuration Summary 1 29 Preferences 1 30 Configuring the Display for Remote Command Setups 1 30 Getting Key Help 1 30 Troubleshooting 1 31 Error Messages 1 32 Error Message File 1 32 Error Message Types 1 33 2 Using IO Interfaces Using GPIB 2 36 Installing the GPIB Interface 2 36 Set Up the GPIB Interface 2 38 Verify GPIB Functionality 2 38 GPIB Interface Terms 2 39 GPIB Programmi...

Страница 6: ...sing VISA and C 3 88 Generating an Externally Applied AC Coupled FM Signal Using VISA and C 3 91 Generating an Internal FM Signal Using VISA and C 3 93 Generating a Step Swept Signal Using VISA and C 3 96 Generating a Swept Signal Using VISA and Visual C 3 98 Saving and Recalling States Using VISA and C 3 101 Reading the Data Questionable Status Register Using VISA and C 3 104 Reading the Service ...

Страница 7: ...anding Waveform Data 5 206 Bits and Bytes 5 206 LSB and MSB Bit Order 5 207 Little Endian and Big Endian Byte Order 5 207 Byte Swapping 5 208 DAC Input Values 5 209 2 s Complement Data Format 5 211 I and Q Interleaving 5 212 Waveform Structure 5 214 File Header 5 214 Marker File 5 214 I Q File 5 216 Waveform 5 216 Waveform Phase Continuity 5 217 Phase Discontinuity Distortion and Spectral Regrowth...

Страница 8: ...e 6 324 Checking Available Memory 6 325 User File Data Bit Binary Downloads 6 327 User File Bit Order LSB and MSB 6 328 Bit File Type Data 6 328 Binary File Type Data 6 331 User File Size 6 332 Determining Memory Usage for Custom User File Data 6 333 Downloading User Files 6 334 Commands for Bit File Downloads 6 338 Commands for Binary File Downloads 6 339 Selecting a Downloaded User File as the D...

Страница 9: ...lter 6 362 Using the Equalization Filter 6 364 Save and Recall Instrument State Files 6 365 Save and Recall SCPI Commands 6 365 Save and Recall Programming Example Using VISA and C 6 366 User Flatness Correction Downloads Using C and VISA 6 379 Data Transfer Troubleshooting 6 384 User File Download Problems 6 384 PRAM Download Problems 6 385 User FIR Filter Coefficient File Download Problems 6 387...

Страница 10: ...10 Contents ...

Страница 11: ... Operating Mode Primary BERT or N5102A BERT Option N5180UN7B Real Time Noise AWGN Option N5180403B Real Time Phase Noise Impairments Option N5180432B Real Time Fading Option 660 Custom Digital Modulation Option N5180431B Multitone and Two Tone Waveforms Option N5180430B Troubleshooting Working in a Secure Environment Programming Guide Getting Started with Remote Operation Using IO Interfaces Progr...

Страница 12: ...ignal generators Service Guide Troubleshooting Replaceable Parts Assembly Replacement Post Repair Procedures Safety and Regulatory Information Instrument History Error Messages Guide Error Messages Error Message Format Error Message Type List of Error Messages Key Helpa Key function description Related SCPI commands a Press the Help key and then the key for which you wish help ...

Страница 13: ...dware Layers on page 14 Interfaces on page 15 IO Libraries and Programming Languages on page 16 Using the Web Browser on page 23 Preferences on page 30 Error Messages on page 32 Keysight does not recommend going backwards in firmware versions loading older firmware versions into newer instruments as hardware firmware conflicts can result ...

Страница 14: ... generators support the following interfaces Use these interfaces in combination with IO libraries and programming languages to remotely control a signal generator Figure 1 1 uses GPIB as an example of the relationships between the interface IO libraries programming language and signal generator Figure 1 1 Software Hardware Layers Table 1 1 Instrument Interfaces Supported Keysight N51xxB EXG MXG G...

Страница 15: ...with the signal generator over the LAN VXI 11 recommended Sockets TELNET FTP The Keysight N51xxB EXG MXG supports LXI Class C functionality For more information on the LXI standards refer to http www lxistandard org home For more information on configuring the signal generator to communicate over the LAN refer to Using LAN on page 42 USB The rear panel Type B or Mini B 5 pin connector is a device ...

Страница 16: ...al generator over different IO interfaces Follow instructions in the setup wizard to install the libraries Refer to the Keysight IO Libraries Suite Help documentation for details about this software To learn about using IO libraries with Windows XP or newer operating systems refer to the Keysight IO Libraries Suite s help located on the Automation Ready CD that ships with your signal generator Oth...

Страница 17: ...1 Run the VISA Assistant program Start All Programs Keysight IO Libraries Suite Keysight Connection Expert Tools Visa Assistant 2 Click on the interface you want to use for sending commands to the signal generator 3 Click the Formatted I O tab 4 Select SCPI in the Instr Lang section You can enter SCPI commands in the text box and send the command using the viPrintf button Windows NT is not support...

Страница 18: ...Keysight IO Libraries Suite Keysight Connection Expert 2 On the tool bar select the Add Interface button 3 Click LAN Interface in the Available interface types text box 4 Click the ADD button 5 Verify that the Auto automatically detect protocol bubble is checked Click O K to use the default settings 6 Click LAN TCPIPO in the Instrument I O on this PC text box 7 On the tool bar select the Add Instr...

Страница 19: ...lows the user to send SCPI commands to instruments and to read instrument data in a variety of formats You can use the VISA Assistant available with the Keysight IO Libraries versions M and earlier to send commands to the signal generator If the interface you want to use does not appear in the VISA Assistant then you must manually configure the interface See the Manual VISA Configuration section b...

Страница 20: ...end the command using the viPrintf button VISA Configuration Manual Perform the following steps to use IO Config and VISA to manually configure an interface 1 Run the IO Config Program 2 Click on GPIB in the Available Interface Types text box 3 Click the Configure button Set the Default Protocol to AUTO and then click OK to use the default settings 4 Click on GPIB0 in the Configured Interfaces tex...

Страница 21: ...om 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 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 porta...

Страница 22: ... SICL is a lower level library that is installed along with Keysight VISA Programming Languages Along with Standard Commands for Programming Instructions SCPI and IO library functions you use a programming language to remotely control the signal generator Common programming languages include C C C MATLAB MATLAB is a registered trademark of The MathWorks HP Basic LabView Java Java is a U S trademar...

Страница 23: ...r to the User s Guide and on page 220 and for FTP see Using FTP on page 56 and FTP Procedures on page 231 The Web Server service is compatible with the Microsoft Internet Explorer 6 0 and newer web browser and operating systems Windows 2000 Windows XP and newer For more information on using the Web Server refer to Enabling the Signal Generator Web Server on page 26 The following example for access...

Страница 24: ...nality For more information on the LXI standards refer to http www lxistandard org home To operate the signal generator click the keys NOTE If you do not see this window check to see if the window is hidden behind your browser window or your web browser settings are set to block pop ups To use this feature you need to set your web browser to allow pop ups for your instrument s IP address Remote SC...

Страница 25: ...al Generators Programming Guide 25 Getting Started with Remote Operation Using the Web Browser 2 Enter the new settings and click Save 3 Click Renew LAN Settings to cause the new settings to take effect Figure 1 3 View Modify Configuration ...

Страница 26: ...ange depending on the LAN configuration see Using LAN on page 42 4 On the computer s keyboard press Enter The web browser displays the signal generator s homepage 5 Click the Signal Generator Web Control menu button on the left of the page The LXI password box is displayed on the computer Refer to the Web Enabled Help 6 Click Submit 7 The front panel web page displays Javascript or Active Scripts ...

Страница 27: ...des drag and drop file capability If you are experiencing problems with opening the signal generator s remote front panel web page verify that the pop up blocker is turned off on your web browser In some cases the Web Enabled front panel may appear behind the main browser window so you must move the browser window to see the Web Enabled front panel The FTP access button opens a window that display...

Страница 28: ...fault Values Confirm Restore LAN Settings to Default Values For more information refer to the signal generator s Web Server Interface Help The instrument s LAN configuration system information can be found on the signal generator s homepage and on the signal generator Refer to Enabling the Signal Generator Web Server on page 26 and to Displaying the LAN Configuration Summary on page 29 There are n...

Страница 29: ...e defaults to a null field b This information is part of the Advanced Information about this Web Enabled signal generator model number Table 1 3 LAN Configuration Summary Values Parameter Default For details on each key and for equivalent SCPI commands if applicable use the key help described in the User s Guide Confirm Restore Settings to Factory Defaults Confirming this action configures the sig...

Страница 30: ...date in Remote until On is highlighted SCPI commands DISPlay REMote ON OFF 1 0 DISPlay REMote For details on each key and for equivalent SCPI commands if applicable use the key help described in User s Guide When you press the front panel Help button Help displays for the next key you press The key help includes a description of the key s functionality and a list of equivalent SCPI commands if the...

Страница 31: ... as well as to the User s Guide before using the diagnostics mode referred to in the Service Guide and in the caution below All X Series signal generators have a fail safe and diagnostic mode that should only be used if all other troubleshooting mentioned in this document has been attempted and failed If the diagnostic mode is determined to be needed refer to the Service Guide If the LAN Reset har...

Страница 32: ...ically In cases where there are multiple listings for the same error number the messages are in alphabetical order For additional general information on troubleshooting problems with your connections refer to the Help in the Keysight IO Libraries and documentation Characteristic SCPI Remote Interface Error Queue Capacity errors 30 Overflow Handling Linear first in first out Replaces newest error w...

Страница 33: ... 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...

Страница 34: ...34 Keysight CXG EXG and MXG X Series Signal Generators Programming Guide Getting Started with Remote Operation Error Messages ...

Страница 35: ...ht Technologies X Series Signal Generators Programming Guide 2 Using IO Interfaces Using the programming examples with GPIB LAN and USB interfaces Using GPIB on page 36 Using LAN on page 42 Using USB on page 58 ...

Страница 36: ...ctions for installing and configuring the card The following table provide lists on some of the available interface cards Also see the Keysight website http www keysight com for details on GPIB interface cards You can also connect GPIB instruments to a PC USB port using the Keysight 82357A USB GPIB Interface Converter which eliminates the need for a GPIB card For more information refer to the tabl...

Страница 37: ...I 488 2 a C C Visual BASIC LabView PCI 32 bit 1 5 MBps Built in National Instruments PCI GPIB Windows NT VISA NI 488 2 C C Visual BASIC LabView PCI 32 bit 1 5 MBps Built in GPIB Interface Card for HP UX Workstations Keysight E2071C HP UX 9 x HP UX 10 01 VISA SICL ANSI C Keysight VEE HP BASIC HP UX EISA 750 Built in Keysight E2071D HP UX 10 20 VISA SICL ANSI C Keysight VEE HP BASIC HP UX EISA 750 B...

Страница 38: ...er GPIB For information and instructions on running these programs refer to the Help menu available in each utility If You Have Problems 1 Verify that the signal generator s address matches the address declared in the program example programs in Chapter 3 2 Remove all other instruments connected through GPIB and rerun the program 3 Verify that the GPIB card s name or id number matches the GPIB nam...

Страница 39: ... 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 ...

Страница 40: ...se portions of programming demonstrate the important features to consider when developing programming for use with the GPIB interface Interface Check using HP Basic and GPIB This portion of the example program Interface Check using HP Basic and GPIB on page 40 causes the signal generator to perform an instrument reset The SCPI command RST places the signal generator into a pre defined state and th...

Страница 41: ...gram example is available on the signal generator Documentation CD ROM as niex1 cpp For the full text of this program refer to Interface Check Using NI 488 2 and C on page 73 or to the signal generator s documentation CD ROM include stdafx h include iostream include windows h include Decl 32 h using namespace std int GPIB0 0 Board handle Addr4882_t Address 31 Declares an array of type Addr4882_t i...

Страница 42: ... TELNET is used for interactive one command at a time instrument control and FTP is for file transfer LXI is used to communicate with multiple instruments through LAN events using precision time protocols For more information on the LXI standards refer to www keysight com find lxi The following sections contain information on selecting and connecting IO libraries and LAN interface hardware that ar...

Страница 43: ...ommunicate with the signal generator over the LAN you must enable the VXI 11 SCPI service Select VXI 11 until On is highlighted Default condition is On Verify that the signal generator is connected to the LAN using a 100Base T LAN or 10Base T LAN cable NOTE For optimum performance use a 100Base T LAN cable to connect the signal generator to the LAN For details on each key or for a list of equivale...

Страница 44: ...rom a different LAN subnet you must also enter the subnet mask and default gateway See your system administrator for more information Manual LAN Configuration Sequence For details on each key use the key help described in User s Guide For additional SCPI command information refer to the SCPI Command Reference Your hostname can be up to 20 characters long Utility IO Config SCPI commands SYSTem COMM...

Страница 45: ...ver cable To do this you should either choose to set IP addresses of the PC and signal generator to differ only in the last digit example PC s IP 1 1 1 1 and Signal generator s IP 1 1 1 2 or you can use the DHCP feature or Auto IP feature if your PC supports them For more information go to www keysight com and search on the Connectivity Guide E2094 90009 or use the Keysight Connection Expert s Hel...

Страница 46: ...gnal generator verify the rear panel LAN connector green LED is on For additional information on troubleshooting your LAN connection refer to the Help in the Keysight IO Libraries and documentation for LAN connections and problems LAN Ping Responses For additional information on troubleshooting your LAN connection refer to If You Have Problems on page 46 and to the Help in the Keysight IO Librarie...

Страница 47: ...ddress are correctly entered in the node names database To do this enter the nslookup hostname 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 LAN Setup menu For more information refer to DHCP Auto IP LAN Configuration S...

Страница 48: ...Click the Edit VISA Config button 7 Click the Add device button 8 Enter the TCPIP address of the signal generator Leave the Device text box empty 9 Click the OK button in this form and all subsequent forms to exit the IO Config program If You Have Problems 1 Verify the signal generator s IP address is valid and that no other instrument is using the IP address 2 Switch between manual LAN configurat...

Страница 49: ... the Default Protocol is set to Automatic 1 Run the IO Config program 2 Click on TCPIP in the Configured Interfaces text box If there is no TCPIP0 in the box follow the steps shown in the section Using VISA Assistant on page 48 3 Click the Edit button 4 Click the radio button for AUTO automatically detect protocol 5 Click OK OK to end the IO Config program ...

Страница 50: ...ntation and Help menu for information on running the IO Config program and configuring the VXI 11 interface Use the IO 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 ...

Страница 51: ...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 Berkel...

Страница 52: ...nd then send or receive information using SCPI commands Communication is interactive one command at a time The following telnet LAN connections are discussed Using Telnet On a PC With a Host Port Setting Menu GUI on page 53 Using Telnet On a PC With a Command Prompt Interface on page 53 The Standard UNIX Telnet Command on page 54 A Telnet example is provided in Unix Telnet Example on page 56 The d...

Страница 53: ...lect Remote System A connection form is displayed See Figure 2 4 4 Enter the hostname port number and TermType then click Connect Host Name signal generator s IP address or hostname Port 5024 Term Type vt100 5 At the SCPI prompt enter SCPI commands Refer to Figure 2 5 on page 53 6 To signal device clear press Ctrl C 7 Select Exit from the Connect menu to end the Telnet session Figure 2 4 Connect F...

Страница 54: ...er the signal generator s IP address followed by a space and 5024 which is the Telnet port associated with the signal generator 5 At the SCPI prompt enter SCPI commands 6 To escape from the SCPI session type Ctrl 7 Type quit at the prompt to end the Telnet session Figure 2 6 Telnet Command Prompt Window The Standard UNIX Telnet Command Synopsis telnet host port Description This command is used to ...

Страница 55: ...ent 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 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 co...

Страница 56: ...er For example Ctrl where the control key and the are pressed at the same time The following example shows Telnet commands telnet myinstrument 5024 Trying Connected to signal generator Escape character is Keysight Technologies N51xx 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 conne...

Страница 57: ...e PC click Start Programs Command Prompt 2 At the command prompt enter ftp IP address or hostname 3 At the user name prompt press enter 4 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 5 Type quit or bye to end your FTP session 6 Type exit to end the command p...

Страница 58: ...and connecting I O libraries and the USB interface that are required to remotely program the signal generator through the computer and combining those choices with one of several possible USB interface protocols Selecting I O Libraries for USB on page 59 Setting Up the USB Interface on page 59 Verifying USB Functionality on page 60 USB cables are not industrial graded and potentially allows data l...

Страница 59: ... 488 2 I O libraries can be used to develop applications for the USB interface See National Instrument s website for information on NI 488 2 SICL Keysight SICL can be used to develop applications for the USB interface See Keysight s website for information on SICL Setting Up the USB Interface Rear Panel Interface Mini B 5 pin To use USB connect the USB cable Refer to Table 2 1 USB Interface Cable ...

Страница 60: ...ls on using the front panel USB Type A and the front panel USB Media operation refer to the User s Guide Table 2 1 USB Interface Cable Quantity Description Keysight Part Number 1 USB cable Mini B 5 pin to Type A 82357 61601 For information on verifying your Mini B 5 pin USB rear panel functionality refer to the Keysight Connection Expert in the Keysight IO Libraries Help The Keysight IO libraries ...

Страница 61: ...logies X Series Signal Generators Programming Guide 3 Programming Examples Using the Programming Interface Examples on page 62 GPIB Programming Interface Examples on page 68 LAN Programming Interface Examples on page 115 ...

Страница 62: ...remote operations enable the signal generator s Update in Remote function Programming Examples Development Environment The C C examples were written using an IBM compatible personal computer PC configured as follows Pentium processor Pentium is a registered trademark of Intel Corporation Windows NT 4 0 operating system or later C C programming language with the Microsoft Visual C 6 0 IDE National ...

Страница 63: ...e Header Files When using the NI 488 2 library add the GPIB 32 OBJ file to the Resource Files add the windows h file to the Header Files add the Deci 32 h file to the Header Files For information on the NI 488 2 library and file requirements refer to the National Instrument website For information on the VISA library see the Keysight website or National Instrument s website To communicate with the...

Страница 64: ...ample program State_Files cs on page 367 you must have the NET framework installed on your computer You must also have the Keysight IO Libraries installed on your computer The NET framework can be downloaded from the Microsoft website For more information on running C programs using NET framework see Chapter 6 Running Basic Examples The BASIC programming interface examples provided in this chapter...

Страница 65: ...f waveform files and are located in Chapter 5 Creating I Q Data Little Endian Order on page 301 Downloading I Q Data on page 304 HP Basic Examples Interface Check using HP Basic and GPIB on page 72 Local Lockout Using HP Basic and GPIB on page 76 Queries Using HP Basic and GPIB on page 80 Running Java Examples The Java program Sockets LAN Programming Using Java on page 150 connects to the signal g...

Страница 66: ... files required to create and play waveform files refer to Chapter 5 Running Perl Examples The Perl example Sockets LAN Programming Using Perl on page 153 uses PERL script to control the signal generator over the sockets LAN interface To communicate with the signal generator over the LAN interface you must enable the VXI 11 SCPI service For more information refer to Configuring the VXI 11 Service ...

Страница 67: ...tain information for installing a GPIB interface card or NI GPIB interface card for your PC or UNIX based system Installing the GPIB Interface Card on page 67 For more information on setting up a GPIB interface card or NI GPIB interface card refer to Set Up the GPIB Interface on page 38 Verify GPIB Functionality on page 38 Installing the GPIB Interface Card Refer to Installing the GPIB Interface o...

Страница 68: ...g the Service Request Interrupt SRQ Using VISA and C on page 110 Before Using the GPIB Examples HP 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 GPIB0 or GPIB1 GPIB Function Statements Command Messages Function statements are the basis for GPIB programming and instrument contro...

Страница 69: ...ght SICL function 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 iabort id Library Function Statement Initialization Command Library Function Statement Initialization Command HP Basic The REMOTE 719 function disables the front panel operation of all keys with the exception of the Local key 10 REMOTE 719 VISA Librar...

Страница 70: ...s all front panel signal generator keys Return to local control can occur only by cycling power on the instrument when the LOCAL command is sent or if the Preset key is pressed SetRWLS parameter list SICL The Keysight SICL igpibllo prevents function prevents user access to front panel keys operation The function puts an instrument identified by the id parameter into remote mode with local lockout ...

Страница 71: ... int ud SICL The Keysight 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 iclear id Library Function Statement Initialization Command HP Basic The function OUTPUT 719 puts the signal generator into remote mode makes it a listener and prepares it to receive data 10 OUTPUT 719 VISA Libr...

Страница 72: ...IB cable 90 Library Function Statement Initialization Command HP 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 10 ENTER 719 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 usin...

Страница 73: ... display 210 REMOTE 719 220 OUTPUT Sig_gen RST Places the signal generator into a defined state 230 PRINT The signal generator should now be in REMOTE 240 PRINT 250 PRINT Verify that the remote R annunciator is on Press the Local key 260 PRINT on the front panel to return the signal generator to local control 270 PRINT 280 PRINT Press RUN to start again 290 END Program ends Interface Check Using N...

Страница 74: ...le and execute the program include stdafx h include iostream include windows h include Decl 32 h using namespace std int GPIB0 0 Board handle Addr4882_t Address 31 Declares an array of type Addr4882_t int main void 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 sig...

Страница 75: ...and enter the following code into your cpp source file visaex1 cpp performs the following functions verifies the GPIB connections and interface are functional switches the signal generator into remote operation mode The following program example is available on the signal generator Documentation CD ROM as visaex1 cpp PROGRAM NAME visaex1 cpp PROGRAM DESCRIPTION This example program verifies that t...

Страница 76: ... 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 n viClose vi closes session viClose defaultRM closes default session Local Lockout Using HP Basic and GPIB This example demonstrates the Local Lockout function Local Lockout disables the front panel signal generator keys...

Страница 77: ...s 140 CLEAR Sig_gen Resets signal generator parser and clears any output 150 LOCAL Sig_gen Places the signal generator in local mode 160 REMOTE Sig_gen Places the signal generator in remote mode 170 CLEAR SCREEN Clears the controllers display 180 OUTPUT Sig_gen RST Places the signal generator in a defined state 190 The following print statements are user prompts 200 PRINT The signal generator shou...

Страница 78: ...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 niex2 cpp performs the following functions all front panel keys except the contrast key places the signal generator into remote prompts the user to verify the signal generator is in remote places the signal generator into local The following program exampl...

Страница 79: ...lected Device Clear SDC message ibwrt sig RST 4 Places signal generator in a defined state cout 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 GPIB0 Resets the GPIB interface Address 0 19 Signal generator s address Address 1 NOADDR Signifies end elem...

Страница 80: ...etup parameters Query commands are identified by the question mark as in the identify command IDN basicex3 txt performs the following functions clears the signal generator queries the signal generator s settings The following program example is available on the signal generator Documentation CD ROM as basicex3 txt 10 20 30 PROGRAM NAME basicex3 txt 40 50 PROGRAM DESCRIPTION In this example query c...

Страница 81: ...resent source CW frequency is F 1 E 6 MHz 230 PRINT 240 OUTPUT Sig_gen POW AMPL Querys the signal generator power level 250 ENTER Sig_gen W Enter the power level 260 Print power level to the controller display 270 PRINT Current power setting is W dBM 280 PRINT 290 OUTPUT Sig_gen FREQ MODE Querys the signal generator for frequency mode 300 ENTER Sig_gen A Enter in the mode CW Fixed or List 310 Prin...

Страница 82: ...PIB 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 Visual C This example uses the NI 488 2 library to query different instrument states and conditions Launch Microsoft Visual C 6 0 add the...

Страница 83: ...amespace std int GPIB0 0 Board handle Addr4882_t Address 31 Declare a variable of type Addr4882_t int main 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 ib...

Страница 84: ...rator power level cout Source power dBm is rdVal cout Press any key to continue endl cin ignore 10000 n ibwrt sig FREQ MODE 11 Querys source frequency mode ibrd sig rdVal 100 Enters in the source frequency mode rdVal ibcntl 0 Null character indicating end of array cout Source frequency mode is rdVal Print source frequency mode cout Press any key to continue endl cin ignore 10000 n ibwrt sig OUTP O...

Страница 85: ...ntrol endl cout endl return 0 Queries for GPIB Using 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 visaex3 cpp performs the following functions verifies the GPIB connections and interface are functional resets the signal generator que...

Страница 86: ...id 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 int num Declares variable to hold integer data Initialize the VISA system viStatus viOpenDefaultRM defaultRM Open session to GPIB device at address 19 viStatus viOpen ...

Страница 87: ... 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 printf n Prints new line character to the display getch viPrintf vi FREQ MODE n 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 k...

Страница 88: ... interface are functional resets the signal generator queries the instrument CW frequency power level frequency mode and RF state reads responses into the rdBuffer CW frequency power level and frequency mode turns signal generator RF state off verifies RF state off The following program example is available on the signal generator Documentation CD ROM as visaex4 cpp PROGRAM FILE NAME visaex4 cpp P...

Страница 89: ...rdBuffer 256 Declare variable to hold string data int num Declare variable to hold integer data viStatus viOpenDefaultRM defaultRM Initialize VISA system Open session to GPIB device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI_NULL VI_NULL vi if viStatus If problems then prompt user printf Could not open ViSession n printf Check instruments and connections n printf n exit 0 viPrintf vi...

Страница 90: ... viPrintf vi OUTP STAT ON n Turn source RF state on viPrintf vi OUTP n Query the signal generator s RF state viScanf vi 1i num Read the response integer value Print the on off RF state if num 0 printf Source RF state is on n else printf Source RF state is off n printf n printf Verify RF state then press continue n printf n getch viClear vi viPrintf vi OUTP STAT OFF n Turn source RF state off viPri...

Страница 91: ...stics Launch Microsoft Visual C 6 0 add the required files and enter the code into your cpp source file visaex5 cpp performs the following functions error checking resets the signal generator sets up the EXT 2 connector on the signal generator for FM sets up FM path 2 coupling to AC sets up FM path 2 deviation to 20 kHz sets carrier frequency to 700 MHz sets the power level to 2 5 dBm turns on fre...

Страница 92: ...ications Initialize VISA session viStatus viOpenDefaultRM defaultRM open session to gpib device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI_NULL VI_NULL vi if viStatus If problems then prompt user printf Could not open ViSession n printf Check instruments and connections n printf n exit 0 printf Example program to set up the signal generator n printf for an AC coupled FM signal n prin...

Страница 93: ...e selected n printf n Prints a carrage return Close the sessions viClose vi viClose defaultRM Generating an Internal FM Signal Using VISA and C In this example the VISA library is used to generate an 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 a...

Страница 94: ...de visa h include StdAfx h include iostream include stdlib h include conio h 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 viStatus viOpenDefaultRM defaultRM Initialize VISA session open session to gpib device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI_...

Страница 95: ... modulation rate of 5 kHz viPrintf vi FM2 DEV 100 kHz n Sets FM path 2 modulation deviation rate of 100 kHz viPrintf vi FREQ 900 MHz n Sets carrier frequency to 900 MHz viPrintf vi POW 15 dBm n Sets the power level to 15 dBm viPrintf vi FM2 STAT ON n Turns on frequency modulation viPrintf vi OUTP STAT ON n Turns on RF output printf n Prints a carriage return Print user information printf Power lev...

Страница 96: ...e visaex7 cpp performs the following functions clears and resets the signal generator sets up the instrument for continuous step sweep sets up the start and stop sweep frequencies sets up the number of steps sets the power level turns on the RF output The following program example is available on the signal generator Documentation CD ROM as visaex7 cpp PROGRAM FILE NAME visaex7 cpp PROGRAM DESCRIP...

Страница 97: ... sig gen freq mode to list viPrintf vi LIST TYPE STEP n Sets sig gen LIST type to step viPrintf vi FREQ 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 Turn...

Страница 98: ...et up and retrace before the next sweep is generated visaex11 cpp performs the following functions sets up the signal generator for a 1 to 2 GHz frequency sweep sets up the signal generator to have a dwell time of 01 seconds and 101 points in the sweep sleep function is used to allow the instrument to complete its sweep operation The following program example is available on the signal generator D...

Страница 99: ...lude windows h void main ViStatus stat ViSession defaultRM inst int npoints 101 double dwell 0 01 int intCounter 5 char instOpenString TCPIP0 141 121 93 101 INSTR stat viOpenDefaultRM defaultRM stat viOpen defaultRM instOpenString VI_NULL VI_NULL inst preset to start clean stat viPrintf inst RST n set power level for 10dBm stat viPrintf inst POW 10DBM n set the start and stop frequency for the swe...

Страница 100: ...S long 2 npoints 015 dwell 1000 set the VISA timeout stat viSetAttribute inst VI_ATTR_TMO_VALUE timeoutMS set continuous trigger mode off stat viPrintf inst INIT CONT OFF n turn list sweep on stat viPrintf inst FREQ MODE LIST n int sweepNo 0 while intCounter 0 start the sweep initialize stat viPrintf inst INIT n printf Sweep d started n sweepNo wait for the sweep completion with OPC int res stat v...

Страница 101: ...signal generator frequency ALC off power level RF output on checks for operation complete saves to settings to instrument register number one recalls information from register number one prompts user input to put instrument into Local and checks for operation complete The following program example is available on the signal generator Documentation CD ROM as visaex8 cpp PROGRAM FILE NAME visaex8 cp...

Страница 102: ...pe ViStatus for GPIB verifications long lngDone 0 Operation complete flag viStatus viOpenDefaultRM defaultRM Initialize VISA session Open session to gpib device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI_NULL VI_NULL vi if viStatus If problems then prompt user printf Could not open ViSession n printf Check instruments and connections n printf n exit 0 printf n viClear vi Clears the s...

Страница 103: ...sig gen state to register 1 Print user information printf The current signal generator operating state will be saved n printf to Register 1 Observe the state then press Enter n printf n Prints new line character getch Wait for user input lngDone 0 Resets the operation complete flag viPrintf vi RST n Resets the signal generator viPrintf vi OPC n Checks for operation complete while lngDone viScanf v...

Страница 104: ...complete while lngDone viScanf vi d lngDone Waits for setup to complete Print user information printf Press Local on instrument front panel to return to manual mode n printf n 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 register is read You wi...

Страница 105: ...dulation condition The following program example is available on the signal generator Documentation CD ROM as visaex9 cpp 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 st...

Страница 106: ... to GPIB device at address 19 viStatus viOpen defaultRM GPIB 19 INSTR VI_NULL VI_NULL vi if viStatus If problems then prompt user printf Could not open ViSession n printf Check instruments and connections n printf n exit 0 printf n viClear vi Clears the signal generator Prints user information printf Programming example to demonstrate reading the signal generator s Status Byte n printf n printf Ma...

Страница 107: ...ster Bits Bits 0 and 1 viPrintf vi STAT QUES POW COND n 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 switch num Based on the decimal value case 1 printf Signal Generator Reverse Power Protection Tripped n printf n break case 2 printf Signal Generator Power is Unleveled n printf n break default ...

Страница 108: ... connect any source to the input n printf Check signal generator s display for the EXT1 LO annunciator n printf n printf Press Enter when ready n printf n getch Waits for keyboard user input viPrintf vi STAT QUES MOD ENAB 16 n Enables the Data Questionable Modulation Condition Register bits 0 1 2 3 and 4 viPrintf vi STAT QUES MOD COND n Querys the register for any set bits viScanf vi s rdBuffer Re...

Страница 109: ...nal Generator Modulation 1 Overmod n printf n break case 4 printf Signal Generator Modulation 2 Undermod n printf n break case 8 printf Signal Generator Modulation 2 Overmod n printf n break case 16 printf Signal Generator Modulation Uncalibrated n printf n break default printf No Problems with Modulation n printf n Close the sessions viClose vi viClose defaultRM ...

Страница 110: ...o your cpp source file visaex10 cpp performs the following functions error checking clears the signal generator resets the signal generator prompts user to manually begin the step sweep and waits for response clears the status register sets up the operation status group to respond to an end of sweep the data questionable status register is enabled to read an unleveled condition prompts user to man...

Страница 111: ...ViSession vi ViEventType eventType ViEvent event ViAddr 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 defaultRM Initialize VISA session if viStatus VI_SUCCESS If problems then prompt us...

Страница 112: ...sweeping The end of n printf sweep will be indicated by an SRQ on the GPIB and the program will end n printf n printf Press Enter to continue n printf n getch viPrintf vi CLS n Clears signal generator status byte 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 Op...

Страница 113: ...T TRIG SOUR IMM n Immediately trigger the sweep viPrintf vi LIST MODE AUTO n Sets mode for the list sweep viPrintf vi FREQ STAR 40 MHZ n Start frequency set to 40 MHz viPrintf vi FREQ STOP 900 MHZ n Stop frequency set to 900 MHz viPrintf vi SWE POIN 25 n Set number of points for the step sweep viPrintf vi SWE DWEL 5 S n Allow 5 sec dwell at each point viPrintf vi INIT CONT OFF n Set up for single ...

Страница 114: ...i viStatus viClose defaultRM return 0 The following function is called when an SRQ 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 ViUInt16 stb status viReadSTB vi stb Reads the Status Byte sweep 0 Sets the flag to stop the printing printf n Print us...

Страница 115: ...ion on configuring and using the VXI 11 protocol The VXI 11 examples use TCPIP0 as the board address Using VXI 11 with GPIB Programs The GPIB programming examples that use the VISA library and are listed in GPIB Programming Interface Examples on page 68 can be easily changed to use the LAN VXI 11 protocol by changing the address string For example change the GPIB 19 INSTR address string to TCPIP h...

Страница 116: ...ecking The following program example is available on the signal generator Documentation CD ROM as vxisicl cpp PROGRAM NAME vxisicl cpp PROGRAM DESCRIPTION Sample test program using SICL and the VXI 11 protocol NOTE You must have the Keysight 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 ...

Страница 117: ... using VXI 11 protocol sprintf instNameBuf lan s inst0 instrumentName id iopen instNameBuf Open instrument session 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 opcResponse Operation complete flag if opcResponse 1 ...

Страница 118: ...vxivisa cpp performs the following functions sets signal generator to a 5 dBm power level queries signal generator for an ID string error checking The following program example is available on the signal generator Documentation CD ROM as vxivisa cpp PROGRAM FILE NAME vxivisa cpp Sample test program using the VISA libraries and the VXI 11 protocol NOTE You must have the Keysight Libraries installed...

Страница 119: ...ion defaultRM instr Declares a type ViSession variable ViUInt32 retCount Return count for string I O ViChar buffer MAX_COUNT Buffer for string I O status viOpenDefaultRM defaultRM Initialize the system Open communication with Serial Port 2 status viOpen defaultRM TPCIP0 19 INSTR VI_NULL VI_NULL instr if status If problems then prompt user printf Could not open ViSession n printf Check instruments ...

Страница 120: ...fer Set sig gen power to 5dbm status viWrite instr ViBuf POW AMPL 5dbm n 15 retCount Query the power level status viWrite instr ViBuf POW n 5 retCount Read the power level status viRead instr ViBuf buffer MAX_COUNT retCount buffer retCount 0 Indicate the end of the string printf Power level Print header to the screen printf buffer Print the queried power level printf n status viClose instr Close d...

Страница 121: ...on 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 c files to your home UNIX directory For example users mydir 2 At the UNIX prompt in your home directory type cc Aa O o lanio lanio c 3 At the UNIX prompt in your home directory type lanio xxxxx IDN where xxxxx is the host...

Страница 122: ...ebug folder For example C SocketIO Lanio Debug 5 After you cd to the directory where the lanio exe file is located type in the following command at the command prompt lanio xxxxx IDN For example C SocketIO Lanio Debug 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 pro...

Страница 123: ...rogramming Guide 123 Programming Examples LAN Programming Interface Examples 3 Select Rebuild All from Build menu Then select Execute Lanio exe The program will run and display results similar to those shown in Figure 3 1 Figure 3 1 Program Output Screen ...

Страница 124: ...cy on signal generator to 2 5 GHz sets power on signal generator to 5 dBm gets option letter from argument vector and checks for end of file EOF The following programming examples are available on the signal generator Documentation CD ROM as lanio c and getopt c Header lanio c 04 24 01 Revision 1 1 Date 10 24 01 PROGRAM NAME lanio c Description Functions to talk to an Keysight signal generator via...

Страница 125: ...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 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 This makes programming very convenient since routines li...

Страница 126: ...his define WINSOCK endif ifndef WINSOCK ifndef _HPUX_SOURCE define _HPUX_SOURCE endif endif include stdio h for fprintf and NULL include string h for memcpy and memset include stdlib h for malloc atol include errno h for strerror ifdef WINSOCK include windows h ifndef _WINSOCKAPI_ include winsock h BSD style socket functions endif else UNIX with BSD sockets include sys socket h for connect and soc...

Страница 127: ...SOCK 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 unistd h for getopt 3C endif define COMMAND_ERROR 1 define NO_CMD_ERROR 0 define SCPI_PORT 5025 define INPUT_BUF_SIZE 64 1024 Display usage static void usage char basename fprintf stderr Usage s nqu hostname command n ba...

Страница 128: ... 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 1 wVersionRequested MAKEWORD 2 0 err WSAStartup wVersionRequested wsaData if err 0 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...

Страница 129: ...ument Parameters const char hostname Network name of instrument This can be in dotted decimal notation int portNumber The TCP IP port to talk to Use 5025 for the SCPI port Return int A file descriptor similar to open 1 Errors returns 1 if anything goes wrong SOCKET openSocket const char hostname int portNumber struct hostent hostPtr struct sockaddr_in peeraddr_in SOCKET s memset peeraddr_in 0 size...

Страница 130: ...KET create a socket s socket AF_INET SOCK_STREAM 0 if s INVALID_SOCKET fprintf stderr unable to create socket to s s n hostname strerror errno return INVALID_SOCKET memcpy peeraddr_in sin_addr s_addr hostPtr h_addr hostPtr h_length peeraddr_in sin_family AF_INET peeraddr_in sin_port htons unsigned short portNumber if connect s const struct sockaddr peeraddr_in sizeof struct sockaddr_in SOCKET_ERRO...

Страница 131: ...arameters FILE file pointer associated with TCP IP socket const char command SCPI command string Return char a pointer to the result string Errors returns 0 if send fails int commandInstrument SOCKET sock const char command int count fprintf stderr Sending s 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 ...

Страница 132: ...rn NO_CMD_ERROR recv_line similar to fgets but uses recv char recv_line SOCKET sock char result int maxLength ifdef WINSOCK int cur_length 0 int count char ptr result int err 1 while cur_length maxLength Get a byte into ptr count recv sock ptr 1 0 If no chars to read stop if count 1 break cur_length count If we hit a newline stop if ptr n ptr err 0 break ...

Страница 133: ...ptr 0 if err return NULL else return result else Simpler UNIX version using file I O recv version works too This demonstrates how to use file I O on sockets in UNIX FILE instFile instFile fdopen sock r if instFile NULL fprintf stderr Unable to create FILE structure s n strerror errno exit 2 return fgets result maxLength instFile endif ...

Страница 134: ...t const char command SCPI command string char result where to put the result size_t maxLength maximum size of result array in bytes Return long The number of bytes in result buffer Errors returns 0 if anything goes wrong long queryInstrument SOCKET sock const char command char result size_t maxLength long ch char tmp_buf 8 long resultBytes 0 int command_err int count Send command to signal generat...

Страница 135: ...tmp_buf 0 if count 1 ch EOF ch n result 0 null terminate result for ascii return 0 use a do while so we can break out do if ch binary data encountered figure out what it is long numDigits long numBytes 0 char length 10 count recv sock tmp_buf 1 0 read 1 char ch tmp_buf 0 if count 1 ch EOF break End of file if ch 0 ch 9 break unexpected char numDigits ch 0 if numDigits read numDigits bytes into res...

Страница 136: ... Loop until we get all the bytes we requested Each call seems to return up to 1457 bytes on HP UX 9 05 do int rcount rcount recv sock result int numBytes 0 resultBytes rcount result rcount Advance pointer while resultBytes numBytes For LAN dumps there is always an extra trailing newline Since there is no EOI line For ASCII dumps this is great but for binary dumps it is not needed if resultBytes nu...

Страница 137: ... sock result maxLength NULL break if strlen result 1 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 return resultBytes ...

Страница 138: ...e SCPI error queue until empty Print results Return void void showErrors SOCKET sock const char command SYST ERR n char result_str 256 do queryInstrument sock command result_str sizeof result_str 1 Typical result_str 221 Settings conflict Frequency span reduced 0 No error Don t bother decoding if strncmp result_str 0 3 0 Matched 0 No error break puts result_str while 1 ...

Страница 139: ...signed char q 0 char query if the command has a in it use queryInstrument otherwise simply send the command Actually we must be a more specific so that marker value querys are treated as commands Example SENS FREQ CENT CALC1 MARK1 X if query strchr cmd NULL Make sure we don t have a marker value query or any command with a followed by a character This kind of command is not a query from our point ...

Страница 140: ...attempt to ignore white spc query else break if query q 1 return q Function main Description Read command line arguments and talk to signal generator Send query results to stdout Return int non zero if an error occurs int main int argc char argv SOCKET instSock char charBuf char malloc INPUT_BUF_SIZE char basename int chr char command 1024 ...

Страница 141: ... if basename NULL basename else basename argv 0 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 command if optind argc destination argv optind strcpy command if optind argc while optind argc hostname command provided only one command string strcat command argv opt...

Страница 142: ...ples LAN Programming Interface Examples else strcat command n else Only hostname provided input on stdin strcpy command if optind argc usage basename exit 1 else no hostname usage basename exit 1 open a socket connection to the instrument ifdef WINSOCK if init_winsock 0 exit 1 endif WINSOCK ...

Страница 143: ...to open socket n return 1 fprintf stderr Socket opened n if strlen command 0 if the command has a in it use queryInstrument otherwise simply send the command 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 fflush stdout else commandInstrument instSock command else read a line from stdin ...

Страница 144: ...e strcat charBuf n if quiet if number char num 10 sprintf num d number fwrite num strlen num 1 stdout fwrite charBuf strlen charBuf 1 stdout fflush stdout 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 ...

Страница 145: ...e Examples if quiet fwrite 2 1 stdout fwrite charBuf strlen charBuf 1 bufBytes 1 stdout fwrite n 1 1 stdout fflush stdout else commandInstrument instSock charBuf if number number if show_errs showErrors instSock ifdef WINSOCK closesocket instSock close_winsock else close instSock endif WINSOCK return 0 End of lanio cpp ...

Страница 146: ...t a series of SCPI commands to the signal generator Send query results to stdout Return int non zero if an error occurs Rename this int main1 function to int main Re compile and the execute the program int main1 SOCKET instSock long bufBytes char charBuf char malloc INPUT_BUF_SIZE open a socket connection to the instrument ifdef WINSOCK if init_winsock 0 exit 1 ...

Страница 147: ...r Socket opened n bufBytes queryInstrument instSock IDN n charBuf INPUT_BUF_SIZE printf ID s n charBuf commandInstrument instSock FREQ 2 5 GHz n printf n 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 printf ...

Страница 148: ...tter 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 from 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 initiali...

Страница 149: ...g h For strchr char optarg 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 0 if optind 0 optind if optind argc argv optind 0 argv optind 1 0 return EOF if strcmp argv optind 0 optind return EOF scan argv optind 1 optind ...

Страница 150: ...gram connects to the signal generator through 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 ...

Страница 151: ... Java The following program example is available on the signal generator Documentation CD ROM as javaex txt 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 GH...

Страница 152: ...cy to 1 GHz out write freq 1GHz n Sets frequency out flush System out println Waiting for source to settle out write opc n Waits for completion out flush String opcResponse in readLine if 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 out flush String idnResponse in readLine Reads the id...

Страница 153: ...xxxx in the code line my instrumentName xxxxx 2 Save the code listed below 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 The following program example is available on the signal generator Documentation CD ROM as perl txt usr bin perl PROGRAM NAME perl txt Example of talking to the signal gen...

Страница 154: ...1 Set up the PSA to measure the modulation 2 Turn on the equalization filter 3 Call loadPsaEqFilterFreq example 1 in Matlab to read out the equalization channel response over LAN via SCPI and calculate the correct equalization filter 4 Call writeMxgFir example 4 in Matlab to write out the equalization filter over LAN via SCPI to the MXG Manual process using the VSA 89600 software to measure the ch...

Страница 155: ...either an equalization filter or a modulation filter and writes it to a FIR file in the MXG This section contains the following examples 1 Example 1 Reading Out the Channel Response and Calculating Corrections for an Equalization Filter Using Matlab 2 Example 2 Reading a PXA Trace and Setting up the Equalization Filter Using Matlab 3 Example 3 Reading a VSA Trace and Setting up the Equalization Fi...

Страница 156: ...ication is over TCP IP LAN destRate is assumed to be 200e6 if missing Example corrFilter loadPsaEqFilter psa4 output of corrFilter is in time domain NOTE The equalization filter feature in the PSA Digital Modulation Modulation Analysis mode must be ON for this script to work It can be set to EQ Hold ON Typically followed with something like writeMxgFir a n5182b 00211 EQ_1GHZ_62MHZ corrFilter if na...

Страница 157: ...h coeffs frequency range is also rate we now have a centered frequency domain version of the channel response invert so that we will cancel the channel response invertedFreqDomain 1 coeffs convert to time domain first placing the 0 frequency at the left edge timeDomain ifft ifftshift invertedFreqDomain put time domain 0 time in center len length timeDomain if mod length timeDomain 2 1 odd center c...

Страница 158: ...nter 127 right left 255 clippedTime resampledTime left right else clippedTime resampledTime end corrFilter clippedTime end function array readArrayOfDoubles fid line fgets fid array sscanf line g c end Example 2 Reading a PXA Trace and Setting up the Equalization Filter Using Matlab This example reads a PXA trace of Eq Ch Freq Resp or Eq Impls Resp and creates an equalization filter compatible wit...

Страница 159: ...d with something like writeMxgFir a n5182b 00211 EQ_1GHZ_62MHZ corrFilter if nargin 1 nargin 3 error corrFilter loadPxaEqFilter pxaAddress destRate displayCorr destRate is assumed to be 200e6 if missing end if nargin 2 destRate 200e6 end if nargin 3 displayCorr 0 end contact PXA t tcpip pxaAddress 5025 t OutputBufferSize 1 1024 1024 t InputBufferSize 1 1024 1024 fopen t fprintf t DISPlay DDEM TRAC...

Страница 160: ...in version again fprintf t DISPlay DDEM TRAC2 FEED Ch Frequency Response1 n fprintf t DISPlay DDEM TRAC2 FORMat MLOG n fprintf t DISPlay DDEM TRAC2 Y AUTO ONCE n must center frequency domain to match what comes in frequency domain coeffs fftshift coeffs fclose t convert to time domain first placing the 0 frequency at the left edge timeDomain ifft ifftshift coeffs centeredTime fftshift timeDomain i...

Страница 161: ... resample unwrap angle fcorrz displayOversample 1 100 pi 180 end clip off the center 256 if necessary if length resampledTime 256 index max abs resampledTime center index left center 127 right left 255 clippedTime resampledTime left right else clippedTime resampledTime end corrFilter clippedTime end function array readArrayOfDoubles fid line fgets fid array sscanf line g c end Example 3 Reading a ...

Страница 162: ...tRate 200e6 end load filter struct from mat file filterStruct load filename coeffs double filterStruct Y if filterStruct XDomain 1 frequency rate filterStruct XDelta length coeffs frequency range is also rate VSA software supplies centered frequency domain else time domain is 2 rate 1 filterStruct XDelta inverse of time step is frequency convert to frequency domain must center frequency domain to ...

Страница 163: ...f abs destRate rate 1e 6 resampledTime resample centeredTime destRate rate 30 resampledTime resampledTime rate destRate else resampledTime centeredTime end clip off the center 256 if necessary if length resampledTime 256 maxval index max abs resampledTime center index left center 127 right left 255 clippedTime resampledTime left right else clippedTime resampledTime end corrFilter clippedTime end E...

Страница 164: ...t using tcp ip Real or complex is auto detected osr is assumed to be 1 if it is missing rate is assumed to be 200Mhz if missing destRate is assumed to be 200Mhz if missing maxTaps is the hardware limit of the MXG 256 if not specified This value should be 256 for the Equalization filter and 32 osr for the Arb Modulation filter Note that the filter has a rectangular window applied with a width of ma...

Страница 165: ...xTaps 2 1 if left 1 left 1 end right left maxTaps 1 while right length timeDomainFilter right right 1 end timeDomainFilter timeDomainFilter left right end rateAdjustedFilter timeDomainFilter open tcp connection t tcpip host 5025 t OutputBufferSize 1024 1024 plenty big for filters write file contents fopen t for writing to a file instead to see what is being output t fopen test w send command with ...

Страница 166: ...mples LAN Programming Interface Examples temp zeros 1 length timeDomainFilter 2 temp 1 2 end real timeDomainFilter temp 2 2 end imag timeDomainFilter timeDomainFilter temp end output osr fprintf t d osr send coefficients fprintf t g timeDomainFilter send terminator fprintf t n fclose t end ...

Страница 167: ...g Guide 4 Programming the Status Register System This chapter provides the following major sections Overview on page 168 Status Register Bit Values on page 172 Accessing Status Register Information on page 173 Status Byte Group on page 179 Status Groups on page 181 ...

Страница 168: ...rting 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 priority status registers propagate their data to the higher priority 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 leve...

Страница 169: ...dard Operation Status register Refer to Status Groups on page 181 for more information Figure 4 1 and Figure 4 2 show the EXG MXG s signal generator status byte register system and hierarchy The status register systems use IEEE 488 2 commands those beginning with to access the higher level summary registers refer to the SCPI Command Reference Access Lower level registers by using STATus commands ...

Страница 170: ...ramming Guide Programming the Status Register System Overview Overall Status Byte Register Systems Overall Status Byte Register System 1 of 2 on page 170 Overall Status Byte Register System 2 of 2 on page 171 Figure 4 1 Overall Status Byte Register System 1 of 2 ...

Страница 171: ...Keysight CXG EXG and MXG X Series Signal Generators Programming Guide 171 Programming the Status Register System Overview Figure 4 2 Overall Status Byte Register System 2 of 2 ...

Страница 172: ...t 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 to query the Standard Operation Status Group s Condition Register send the command STATus OPERa...

Страница 173: ...ion 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 through the transition registers the signal generator monitors it for a change in its condition If this change in conditi...

Страница 174: ...must repeatedly read the registers Use the SRQ method if you must know immediately when a condition changes 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 the controller do something else while waiting when you can t afford the performance penalty inherent to po...

Страница 175: ...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 7 128 and bit 3 8 The SRQ process asserts SRQ as true and sets the status byte s RQS bit to 1 Both actions are necessary to inform the control...

Страница 176: ...n 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 ...

Страница 177: ... Generators Programming Guide 177 Programming the Status Register System Accessing Status Register Information STATus PRESet presets all transition filters non IEEE 488 2 enable registers and error event queue enable registers Refer to Table ...

Страница 178: ...Tus 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 POWer ENABle 32767 STATus QUEStionable POWer NTRansition 32767 STATus QUEStionable POWer PTRansition 32767 STATus QUEStionable BERT ENABle 3276...

Страница 179: ...Guide 179 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 NOTE Some signal generator models may use only a subset of the status registers shown ...

Страница 180: ...vice 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 ORed and input to this bit 7 Standard Operation Status Summary B...

Страница 181: ...the event register when the condition bit changes from 0 to 1 Event Register 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 Event Enable Register An enable register specifi...

Страница 182: ...ator modelsmay use only a subset of the status registers Bit Description 0 Operation Complete A 1 in this bit position indicates that all pending signal generator operations were completed 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...

Страница 183: ...mbers from 199 to 100 6 User Request Key Local A 1 in this bit position indicates that the Local key has been pressed This is true even if the signal generator is in local lockout mode 7 Power On A 1 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 s...

Страница 184: ...r the Standard Operation Transition Filters negative and positive the Standard Operation Event Register and the Standard Operation Event Enable Register Some of the bits in this status group do not apply to all models and return zero when queried See Table 4 3 on page 185 for more information The SCPI command STAT OPER SUPP can suppress the managing of this status group and save 50 us from the swi...

Страница 185: ... in this bit position indicates that the signal generator is settling 2 Unused This bit position is always set to 0 3 Sweeping A 1 in this bit position indicates that a sweep is in progress 4b Measuring A 1 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 6 14 Unused Thes...

Страница 186: ...ndard 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 Query STATus OPERation EVENt Command STATus OPERation ENABle value where value is the sum of the decimal values of the bits you want to enable Example To enable bit 5and bit 3 so that whenever either of those bits are set to 1 the Stan...

Страница 187: ...stionable Transition Filters negative and positive the Data Questionable Event Register and the Data Questionable Event Enable Register Data Questionable Condition Register The Data Questionable Condition Register continuously monitors the hardware and firmware status of the signal generator Condition registers are read only Some of the bits in this status group do not apply to all models and retu...

Страница 188: ...Calibration summary This is a summary bit taken from the QUEStionable CALibration register A 1 in this bit position indicates that one of the following may have happened an error has occurred in the DCFM zero calibration or an error has occurred in the I Q calibration See the Data Questionable Calibration Status Group on page 196 for more information 9 Self Test A 1 in this bit position indicates ...

Страница 189: ...e 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 Commands STATus QUEStionable NTRansition value 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...

Страница 190: ...le 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 Some of the bits in this status group do not apply to all models and return zero when queried See Table 4 5 on page 191 for more information N...

Страница 191: ...r Protection Tripped A 1 in this bit position indicates that the reverse power protection RPP circuit has been tripped There is no output in this state Any conditions that may have caused the problem should be corrected Reset the RPP circuit by sending the remote SCPI command OUTput PROTection CLEar Resetting the RPP circuit bit resets this bit to 0 1 Unleveled A 1 in this bit position indicates t...

Страница 192: ...estionable Condition Register to 1 Command STATus QUEStionable POWer ENABle value where value is the sum of the decimal values of the bits you want to enable Example Enable bit 3 and bit 2 so that whenever either of those bits are 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 12 8 4 Query STATus QUEStion...

Страница 193: ... 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 Some of the bits in this status group do not apply to all models and return zero when queried See Table 4 6 on page 194 for more...

Страница 194: ...only Reading data from an event register clears the content of that register Table 4 6 Data Questionable Frequency Condition Register Bits Bit Description 0 Synth Unlocked A 1 in this bit position indicates that the synthesizer is unlocked 1 10 MHz Ref Unlocked A 1 in this bit position indicates that the 10 MHz reference signal is unlocked 2 Frequency Clipped A 1 in this bit position indicates tha...

Страница 195: ...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 5 and bit 2 so that whenever either of those bits are 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 36 32 4 Query STATus QUEStionable FREQuency ENABl...

Страница 196: ...dition 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 Some of the bits in this status group do not apply to all models and return zero when queried See Table 4 7 on page 197 for ...

Страница 197: ... destructive read only Reading data from an event register clears the content of that register Table 4 7 Data Questionable Calibration Condition Register Bits Bit Description 0 DCFM Calibration Failure A 1 in this bit position indicates that the DCFM zero calibration routine has failed This is a critical error The output of the source has no validity until the condition of this bit is 0 1 I Q Cali...

Страница 198: ...ionable 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 1 and bit 0 so that whenever either of those bits are 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 3 2 1 Query STATus ...

Страница 199: ...hat set bit 12 in the Data Questionable Condition Register The Data Questionable Status group consists of the Data Questionable BERT Condition Register the Data Questionable BERT Transition Filters negative and positive the Data Questionable BERT Event Register and the Data Questionable BERT Event Enable Register This status group applies only to signal generator models with Option N5180UN7B Refer...

Страница 200: ...ble 4 8 Data Questionable BERT Condition Register Bits Bit Description 0 No Clock A 1 in this bit position indicates no clock input for more than 3 seconds 1 No Data Change A 1 in this bit position indicates no data change occurred during the last 200 clock signals 2 PRBS Sync Loss A 1 is set while PRBS synchronization is not established RST sets the bit to zero 3 14 Unused These bits are always s...

Страница 201: ...ble Register lets you choose which bits in the Data Questionable BERT Event Register set the summary bit bit 3 of the Data Questionable Condition Register to 1 Query STATus QUEStionable BERT EVENt Command STATus QUEStionable BERT ENABle value where value is the sum of the decimal values of the bits you want to enable Example Enable bit 2 and bit 1 so that whenever either of those bits are set to 1...

Страница 202: ...202 Keysight CXG EXG and MXG X Series Signal Generators Programming Guide Programming the Status Register System Status Groups ...

Страница 203: ...0 Commands for Downloading and Extracting Waveform Data on page 225 Creating Waveform Data on page 235 Downloading Waveform Data on page 241 Loading Playing and Verifying a Downloaded Waveform on page 247 Using the Download Utilities on page 250 Downloading E443xB Signal Generator Files on page 251 Programming Examples on page 253 Troubleshooting Waveform Files on page 317 The ability to play exte...

Страница 204: ... can download it into another Keysight signal generator that has the same option or software license required to play it Waveform files consist of three items 1 I Q data 2 Marker data 3 File header The signal generator automatically creates the marker file and the file header if the two items are not part of the download In this situation the signal generator sets the file header information to un...

Страница 205: ... 60 I and 60 Q data points Interleaved I and Q data Big endian byte order The same name for the marker header and I Q file This is only a requirement if you create and download a marker file and or file header otherwise the signal generator automatically creates the marker file and or file header using the I Q data file name For more information see Waveform Structure on page 214 For more informat...

Страница 206: ...ion within the data and we read the data from right to left The signal generator accepts data in the form of bytes Bytes are groups of eight bits 01101110 0 x 27 1 x 26 1 x 25 0 x 24 1 x 23 1 x 22 1 x 21 0 x 20 110 decimal value The maximum value for a single unsigned byte is 255 11111111 or 28 1 but you can use multiple bytes to represent larger values The following shows two bytes and the result...

Страница 207: ...that the LSB and MSB positioning changes with the byte order In little endian order the LSB and MSB are next to each other in the bit sequence Most Significant Bit MSB This bit has the highest value greatest weight and is located at the far left of the bit string Least Significant Bit LSB This bit has the lowest value bit position zero and is located at the far right of the bit string 1 0 1 1 0 1 ...

Страница 208: ... you use the data in binary format as is done when downloading data to the signal generator Byte Swapping While the processor for the development platform determines the byte order the recipient of the data may require the bytes in the reverse order In this situation you must reverse the byte order before downloading the data This is commonly referred to as byte swapping You can swap bytes either ...

Страница 209: ...Remember that with 16 bits we have a range of 0 65535 but the signal generator divides this range between positive and negative values 32767 positive full scale output 0 0 volts 32768 negative full scale output Because the DAC s range uses both positive and negative values the signal generator requires signed input values The following list illustrates the DAC s input value range Notice that it ta...

Страница 210: ...yntax as for the E443xB models For more information on downloading E443xB files see Downloading E443xB Signal Generator Files on page 251 Scaling DAC Values The signal generator uses an interpolation algorithm sampling between the I Q data points when reconstructing the waveform For common waveforms this interpolation can cause overshoot which may exceed the limits of the signal process path s int...

Страница 211: ...if you sum the binary positive and negative values you get zero The one difference with binary values is that you have a carry which is ignored The following shows how to calculate the two s complement using 16 bits The process is the same for both positive and negative values The signal generator factory preset for scaling is 70 If you reduce the DAC input values ensure that you set the signal ge...

Страница 212: ...ate arrays or files The signal generator requires a single I Q file for waveform data playback The process of interleaving creates a single array with alternating I and Q data points with the Q data following the I data This array is then downloaded to the signal generator as a binary file The interleaved file comprises the waveform data points where each set of data points one I data point and on...

Страница 213: ...ier E443xB ESG models For more information on downloading E443xB files see Downloading E443xB Signal Generator Files on page 251 11001010 01110110 01110111 00111110 I Data Q Data 11101001 11001010 01011110 01110010 11001010 01110110 11101001 11001010 01110111 00111110 01011110 01110010 I Data Q Data I Data Q Data Interleaved Binary Data CA 76 E9 CA 77 3E 5E 72 Q Data Q Data I Data I Data Interleav...

Страница 214: ...nsure that you configure and save the file header settings for each waveform Marker File The marker file uses one byte per I Q waveform point to set the state of the four markers either on 1 or off 0 for each I Q point When a marker is active on an output trigger signal is sent to a corresponding rear panel BNC and or AUX IO connector pin For more information on active markers and their output tri...

Страница 215: ...matically creates a marker file with all points set to zero For more information on markers see the User s Guide Marker Byte 0000 1 0 1 1 Binary Hex Marker Number Position 4 3 2 1 Reserved 0000 0101 05 Sets markers 1 and 3 on for a waveform point Example of Setting a Marker Byte 01 Marker 1 on 05 Markers 1 and 04 Marker 3 on 00 No active mark 0f All markers on Downloading marker data using a file ...

Страница 216: ... file header while required does not affect the number of bytes that compose a waveform sample One sample contains five bytes To create a waveform the signal generator requires a minimum of 60 samples To help minimize signal imperfections use an even number of samples for information on waveform continuity see Waveform Phase Continuity on page 217 When you store waveforms the signal generator save...

Страница 217: ...re may have been simulated in software or captured off the air and sampled It is an accurate sinewave for the time period it occupies however the waveform does not occupy an entire period of the sinewave or some multiple thereof Therefore when repeatedly playing back the waveform by an arbitrary waveform generator a phase discontinuity is introduced at the transition point between the beginning an...

Страница 218: ...form exceeds the waveform playback memory available in the arbitrary waveform generator a periodic phase discontinuity could be unavoidable The following figures illustrate the influence a single sample can have The generated 3 tone test signal requires 100 samples in the waveform to maintain periodicity for all three tones The measurement on the left shows the effect of using the first 99 samples...

Страница 219: ...uity signal The measurement on the right shows the same waveform using all 100 samples to maintain periodicity and avoid a phase discontinuity Maintaining periodicity removes the distortion products 3 tone 20 MHz Bandwidth 3 tone 20 MHz Bandwidth Measured distortion 35 dBc Phase Continuity Measured distortion 86 dBc Phase Discontinuity ...

Страница 220: ...ck memory To play back waveforms they must reside in volatile memory The following file types share this memory The X Series ARB Waveform File Cache is limited to 128 files Consequently once the 128 file cache limit has been reached the waveform switching speed will be much slower for files loaded into the volatile BBG For cache information always refer to the Data Sheet for the current informatio...

Страница 221: ...t X Series signal generators the non volatile memory is referred to as internal media and external media The following file types share this memory The following figure on Figure 5 1 on page 222 shows the locations within the signal generator for volatile and non volatile waveform data Table 5 2 Signal Generators and Non Volatile Memory Types Non Volatile Memory Type Signal Generator Model N5166B ...

Страница 222: ...nal generator to allocate more memory than what is actually used which decreases the amount of available memory USER HEADER MARKERS WAVEFORM SEQ SECUREWAVE BBG1 Non volatile Volatile waveform HEADER MARKERS WAVEFORM SECUREWAVE Root directory Volatile waveform data 1 The Keysight X Series signal generator use an optional USB media to store non volatile waveform data 2 The Keysight X Series signal g...

Страница 223: ...aveform encryption of proprietary information is supported on the external non volatile USB flash memory To copy unencrypted data files from an external media as in USB Flash Drive UFD for playing on a signal generator the full filename extension is required i e MARKER HEADER WAVEFORM etc For more information on unencrypted data refer to Commands for Downloading and Extracting Waveform Data on pag...

Страница 224: ...emory for each model and option 128 MB 255 MB 4K 256 MB 511 MB 8K 512 MB 1023 MB 16K 1024 MB 2048 MB 32K 2048 MB 4096 MB 64K 4096 MB 8192 MB 128K 8192 MB 16384 MB 256K Table 5 3 Drive Size logical volume Drive Size logical volume Cluster Size Bytes Minimum Allocation Size Table 5 4 Maximum Signal Generator Memory Volatile BBG Memory Non Volatile Internal Storage and USB Media Memory Option Size Op...

Страница 225: ... also extract encrypted waveform data created with software such as MATLAB or ADS providing the data was downloaded to the signal generator using the proper command When you download an exported waveform using a Keysight Signal Studio software product you can use the FTP process and the securewave directory or SCPI commands to extract the encrypted file to the non volatile memory on the signal gen...

Страница 226: ...ile Transfer Methods SCPI using VXI 11 VMEbus Extensions for Instrumentation as defined in VXI 11 SCPI over the GPIB or RS 232 SCPI with sockets LAN using port 5025 File Transfer Protocol FTP To extract files other than user created I Q files and to download encrypted files you must use the securewave directory If you attempt to extract previously downloaded encrypted files including Signal Studio...

Страница 227: ...tual binary waveform data The following example demonstrates this structure WFM1 the file path my_file the I Q file name as it will appear in the signal generator s memory catalog indicates the start of the data block 3 B has three decimal digits 240 240 bytes of data to follow in C 12 S 4 07 8g Y9 7 the ASCII representation of some of the binary data downloaded to the signal generator however not...

Страница 228: ...EM DATA user waveform file_name blockdata MMEM DATA user markers file_name blockdata MMEM DATA user header file_name blockdata Table 5 6 Downloading Encrypted Files for No Extraction Download Method Memory Type Command Syntax Options SCPI volatile memory MMEM DATA user bbg1 securewave file_name blockdata MMEM DATA SWFM1 file_name blockdata MMEM DATA file_name SWFM1 blockdata SCPI non volatile memo...

Страница 229: ...on volatile memoryb put file_name user waveform file_name put file_name user markers file_name put file_name user header file_name a The MEM DATA UNPRotected command is not required to be able to extract files i e use MEM DATA For more information refer to the SCPI Command Reference b See FTP Procedures on page 231 Table 5 8 Extracting Unencrypted I Q Data Download Method Memory Type Command Synta...

Страница 230: ...otected file_name SNVWFM blockdata FTP volatile memoryb put file_name user bbg1 securewave file_name FTP non volatile memoryb put file_name user securewave file_name a The MEM DATA UNPRotected command is not required to be able to extract files i e use MEM DATA For more information refer to the SCPI Command Reference b See FTP Procedures on page 231 Table 5 10 Extracting Encrypted Waveform Data Do...

Страница 231: ...lorer window 3 Drag and drop files between the PC and the Internet Explorer window Using the Command Window PC or UNIX This procedure downloads to non volatile memory To download to volatile memory change the file path Avoid using the OPC or WAI commands to verify that the FTP process has been completed These commands can potentially hang up due to the processing of other SCPI parser operations Re...

Страница 232: ... s user waveform directory If filename1 is unspecified ftp uses the specified file_name to name file_name1 If a marker file is associated with the data file use the following command to download it to the signal generator put marker file_name user markers file_name1 where marker file_name is the name of the file to download and file_name1 is the name designator for the file in the signal generator...

Страница 233: ... PC UNIX For more examples of get command usage refer to Table 5 12 6 At the ftp prompt type bye 7 At the command prompt type exit Using the Signal Generator s Internal Web Server 1 Enter the signal generator s hostname or IP address in the URL http host name or IP address 2 Click the Signal Generator FTP Access button located on the left side of the window Correct put filename wfm put filename mk...

Страница 234: ...reating and Downloading Waveform Files Commands for Downloading and Extracting Waveform Data The signal generator files appear in the web browser s window 3 Drag and drop files between the PC and the browser s window For more information on the web server feature see Chapter 1 ...

Страница 235: ...programming languages this includes C VB VEE MS Visual Studio Net Labview and so forth No matter which programming environment you use to create the waveform data make sure that the data conforms to the data requirements shown on page 205 To learn about I Q data for the signal generator see Understanding Waveform Data on page 206 Code Algorithm This section uses code from the C programming example...

Страница 236: ...and scale the I data DAC values This example uses a simple sine equation where 2 3 14 equals one waveform cycle Change the equation to fit your application The array pointer index increments from 0 499 creating 500 I data points over one period of the sine waveform Set the scale of the DAC values in the range of 32768 to 32767 where the values 32768 and 32767 equal full scale negative and positive...

Страница 237: ...an and Big Endian Byte Order on page 207 Line Code Description Saving the I Q Data to a Text File 12 13 14 15 16 17 18 19 char ofile c temp iq txt FILE outfile fopen ofile w if outfile NULL perror Error opening file to write for index 0 index numsamples index fprintf outfile d d n idata index qdata index fclose outfile Line Code Description Saving the I Q Data to a Text File 12 Set the absolute pa...

Страница 238: ...ing and Byte Swapping for Little Endian Order 20 Define a character array to store the interleaved I and Q data The character array makes byte swapping easier since each array location accepts only 8 bits 1 byte The array size increases by four times to accommodate two bytes of I data and two bytes of Q data 21 29 Create a loop to do the following Save the current I data array value to a variable ...

Страница 239: ...nd Q data interleave with each loop cycle This is due to the I Q array shifting by one location for each I and Q operation index 4 n Line Code Description Interleaving and Byte Swapping for Little Endian Order 1 0 1 1 0 1 1 1 15 14 13 12 11 10 9 8 Data Bit Position Little Endian Order 1 1 1 0 1 0 0 1 7 6 5 4 3 2 1 0 Hex values E9 B7 Data pointer Data pointer shifted 8 bits 1 0 1 1 0 1 1 1 15 14 13...

Страница 240: ... data for Big Endian Order 20 Define a 16 bit integer short array to store the interleaved I and Q data The array size increases by two times to accommodate two bytes of I data and two bytes of Q data NOTE In rare instances a compiler may define short as larger than 16 bits If this condition exists replace short with the appropriate object or label that defines a 16 bit integer 21 25 Create a loop...

Страница 241: ... is done to help you understand the code algorithm in downloading the interleaved I Q data so you can leverage the concept into your programming environment While not discussed in this section you may also save the data to a binary file and use one of the download utilities to download the waveform data see Using the Download Utilities on page 250 If you do not need the level of detail this sectio...

Страница 242: ...rator 1 Sets up a structure indicated above by io used by subsequent function calls to establish a LAN connection to the signal generator agt_newconnection is the function of Keysight Waveform Download Assistant used in MATLAB to build a connection to the signal generator If you are using GPIB to connect to the signal generator provide the board primary address and secondary address io agt_newconn...

Страница 243: ...th this function you can perform the following actions download complex I Q data name the file optional argument set the sample rate optional argument If you do not set a value the signal generator uses its preset value or if a waveform was previously played the value from that waveform start or not start waveform playback after downloading the data optional argument Use either the argument play o...

Страница 244: ...the SICL function iopen refer to the online Keysight SICL User s Guide for Windows 2 Open a connection session with the signal generator to download the generated I Q data The SICL function iopen is from the Keysight IO library and creates a session that returns an identifier to id If iopen succeeds in establishing a connection the function returns a valid session id The valid session id is not vi...

Страница 245: ... 2000 then s 2000 strlen s 4 so cmd MEM DATA WFM1 FILE1 42000 14 Send the SCPI command stored in the string cmd to the signal generator which is represented by the session id iwrite is a SICL function in Keysight IO library which writes the data block data specified in the string cmd to the signal generator id The third argument of iwrite strlen cmd informs the signal generator of the number of by...

Страница 246: ...write writes the data n to the signal generator session identifier specified in id The third argument of iwrite 1 sends one byte to the signal generator The fourth argument of iwrite 1 is the END of file indicator which the program uses to terminate the data download To verify the waveform data download see Loading Playing and Verifying a Downloaded Waveform on page 247 Line Code Description Downl...

Страница 247: ...1 file_name MEMory COPY NAME NVHDR file_name HDR file_name Playing the Waveform Play the waveform and use it to modulate the RF carrier 1 List the waveform files from the volatile memory waveform list Send the following SCPI command MMEMory CATalog WFM1 2 Select the waveform from the volatile memory waveform list Send the following SCPI command SOURce RADio ARB WAVeform WFM1 file_name 3 Play the w...

Страница 248: ... If the oscilloscope display and the I and Q data plots differ recheck your code For detailed information on programmatically creating and downloading waveform data see Creating Waveform Data on page 235 and Downloading Waveform Data on page 241 For information on the waveform data requirements see Waveform Data Requirements on page 205 Building and Playing Waveform Sequences The signal generator ...

Страница 249: ...e memory as a waveform sequence file_name define the number of repetitions reps each waveform segment plays and enable disable markers M1 M2 M3 M4 for each waveform segment Send the following SCPI command SOURce RADio ARB SEQuence file_name waveform1 reps M1 M2 M3 M4 waveform 2 reps ALL SOURce RADio ARB SEQuence file_name 4 Play the waveform sequence Send the following SCPI commands SOURce RADio A...

Страница 250: ...ht Waveform Download Assistant http www keysight com find downloadassistant This software provides functions for the MATLAB environment to download waveform data Table 5 13 Features Keysight Signal Studio Toolkit 2 Keysight Waveform Download Assistant Downloads encrypted waveform files X Downloads complex MATLAB waveform data X Downloads MATLAB files mat X Downloads unencrypted interleaved 16 bit ...

Страница 251: ...e signal generator automatically converts the E443xB files to the proper file format as described in Waveform Structure on page 214 and stores them in the signal generator s memory This conversion process causes the signal generator to take more time to download the earlier file format To minimize the time to convert earlier E443xB files to the proper file format store E443xB file downloads to vol...

Страница 252: ...d Q waveform block data represents data in the E443xB file format The string variable file_name is the name of the I and Q data file After downloading the data the signal generator associates a file header and marker file with the I Q data file To avoid overwriting the current waveform in volatile memory before downloading files into volatile memory WFM1 change the file name or turn off the ARB Fo...

Страница 253: ...pter 2 of this programming guide for information on interfaces and IO libraries The example programs are also available on the signal generator Documentation CD ROM which allows you to cut and paste the examples into an editor The programming examples contain instrument specific information However users can still use these programming examples by substituting in the instrument specific informatio...

Страница 254: ... offset_iq_c txt This C programming example compiled using Microsoft Visual C 6 0 follows the same coding algorithm as the MATLAB programming example Creating and Storing I Q Data on page 284 and performs the following functions error checking data creation data normalization data scaling I Q signal offset from the carrier single sideband suppressed carrier signal byte swapping and interleaving fo...

Страница 255: ...ppressed Carrier SSBSC signal It is nothing more than a cosine wavefomm in I and a sine waveform in Q int points POINTS Number of points in the waveform int cycles 101 Determines the frequency offset from the carrier double Iwave POINTS I waveform double Qwave POINTS Q waveform short int waveform 2 POINTS Holds interleaved I Q data double maxAmp 0 Used to Normalize waveform data double minAmp 0 Us...

Страница 256: ...ort integers 16 bits The data has values scaled between 32767 where DAC Value Description 32767 Maximum positive value of the DAC 0 Zero out of the DAC 32767 Maximum negative value of the DAC The internal arb expects the data bytes to be in Big Endian format This is opposite of how short integers are saved on a PC Little Endian For this reason the data bytes are swapped before being saved Find the...

Страница 257: ...Q data scale 32767 maxAmp Watch out for divide by zero for i 0 i points i waveform 2 i short floor Iwave i scale 0 5 waveform 2 i 1 short floor Qwave i scale 0 5 If on a PC swap the bytes to Big Endian if strcmp computer PCWIN 0 if PC pChar char waveform 0 Character pointer to short int data for i 0 i 2 points i buf pChar pChar pChar 1 pChar 1 buf pChar 2 Save the data to a file Use FTP or one of ...

Страница 258: ...rm Read in waveform as unsigned short integers Swap the bytes as necessary Normalize between 1 De interleave the I Q Data Open the file and load the internal format data stream fopen filename r b Open the file if stream NULL perror Cannot Open File int numread fread void waveform sizeof short points 2 stream fclose stream Close the file If on a PC swap the bytes back to Little Endian if strcmp com...

Страница 259: ... EXG and MXG X Series Signal Generators Programming Guide 259 Creating and Downloading Waveform Files Programming Examples for i 0 i points i IwaveIn i waveform 2 i 32767 0 QwaveIn i waveform 2 i 1 32767 0 return 0 ...

Страница 260: ...e storing to a PC or workstation After creating the binary file you can use FTP one of the download utilities or one of the C download programming examples to download the file to the signal generator include iostream include fstream include math h include stdlib h 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 pai...

Страница 261: ... have a sine wave and the Q channel will a cosine wave for int i 0 i SAMPLES i iqData 2 i AMPLITUDE sin two_pi i float SAMPLES iqData 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 i 0 i 4 SAMPLES i 2 4 SAMPLES char temp cptr i swap LSB and MSB bytes cptr i cptr ...

Страница 262: ...r data interleaving for big endian order data data saving to an array data block data block download to the signal generator This C program is an example of creating and scaling I and Q data and then downloading the data into the signal generator as an interleaved I Q file This example uses a sine and cosine wave as the I Q data Include the standard headers for SICL programming include sicl h incl...

Страница 263: ...AMPLES Fill the I and Q buffers with the sample data for int index 0 index numsamples index Create the I and Q data for the number of waveform points and Scale the data 20000 as a precentage of the DAC full scale 32768 to 32767 This example scales to approximately 70 of full scale idata index 23000 sin 4 3 14 index numsamples qdata index 23000 cos 4 3 14 index numsamples Print the I and Q values t...

Страница 264: ...s and 2 Q bytes char iqbuffer NUMSAMPLES 4 Interleave I and Q and swap bytes from little endian order to big endian order for index 0 index numsamples index int ivalue idata index int qvalue qdata index iqbuffer index 4 ivalue 8 0xFF high byte of i iqbuffer index 4 1 ivalue 0xFF low byte of i iqbuffer index 4 2 qvalue 8 0xFF high byte of q iqbuffer index 4 3 qvalue 0xFF low byte of q Big Endian or...

Страница 265: ...d fprintf stderr iopen failed s n instOpenString return 1 Declare variables to hold portions of the SCPI command int bytesToSend char s 20 char cmd 200 bytesToSend numsamples 4 calculate the number of bytes sprintf s d bytesToSend create a string s with that number of bytes The SCPI command has four parts Part 1 MEM DATA filename Part 2 length of Part 3 when written to a string Part 3 length of th...

Страница 266: ...t command here In many programming languages there are two methods to send SCPI commands Method 1 stop at the first 0 in the data Method 2 send a fixed number of bytes ignoring 0 in the data You must find and use the correct command for Method 2 iwrite id iqbuffer bytesToSend 0 0 Send a terminating carriage return iwrite id n 1 1 0 printf Loaded file using the E4438C E8267C and E8267D format n ret...

Страница 267: ...PC or workstation binary file download to the signal generator Description Send a file in blocks of data to a signal generator include sicl h include stdlib h include stdio h include string h ATTENTION Configure these three lines appropriately for your instrument and use before compiling and running char instOpenString gpib7 19 for LAN replace with lan hostname or IP address const char localSrcFil...

Страница 268: ...le fprintf stderr Could not open file s n localSrcFile return 0 if fseek file 0 SEEK_END 0 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 0 fprintf stderr Cannot seek to the start of file n return 0 char buf new char BUFFER_SIZE if buf lenToSend Prepare and send the SCPI command header char s 20 sprintf s d...

Страница 269: ...SIZE file iwrite id buf numRead 0 0 while numRead BUFFER_SIZE Send the terminating newline and EOM iwrite id n 1 1 0 delete buf else fprintf stderr Could not allocate memory for copy buffer n fclose file iclose id return 0 Importing and Downloading Using VISA Big Endian Order On the documentation CD this programming example s name is DownLoad_Visa_c txt This C programming example compiled using Mi...

Страница 270: ...AN TCPIP to download a file to the signal generator s non volatile memory 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 uses the LAN TCPIP to download a waveform file into...

Страница 271: ...lib h include stdio h include string h include visa h IMPORTANT Configure the following three lines correctly before compiling and running char instOpenString TCPIP0 xxx xxx xxx xxx INSTR your instrument s IP address const char localSrcFile Files IQ_DataC const char instDestFile USER WAVEFORM IQ_DataC const int BUFFER_SIZE 100 1024 Size of the copy buffer int main int argc char argv ViSession defa...

Страница 272: ...ailed s n instOpenString return 1 FILE file fopen localSrcFile rb Open local source file for binary reading if file If any errors display the error and exit the program fprintf stderr Could not open file s n localSrcFile return 0 if fseek file 0 SEEK_END 0 fprintf stderr Cannot lseek to the end of file n return 0 long lenToSend ftell file Number of bytes in the file printf File size d n lenToSend ...

Страница 273: ...SetAttribute vi VI_ATTR_SEND_END_EN 0 Prepare and send the SCPI command header char s 20 sprintf s d lenToSend int lenLen strlen s unsigned char s2 256 Write the command mmem data and the header The number lenLen represents the number of bytes and the actual number of bytes is the variable lenToSend sprintf char s2 mmem data s d d instDestFile lenLen lenToSend Send the command and header to the si...

Страница 274: ...d fread buf sizeof char BUFFER_SIZE file viWrite vi buf numRead 0 while numRead BUFFER_SIZE Send the terminating newline and EOI viSetAttribute vi VI_ATTR_SEND_END_EN 1 char newLine n viWrite vi unsigned char newLine 1 0 delete buf else fprintf stderr Could not allocate memory for copy buffer n fclose file viClose vi viClose defaultRM return 0 ...

Страница 275: ...ng for little endian order data data interleaving for big endian order data data scaling binary file download for earlier E443xB data or current signal generator formatted data This C program is an example of loading I and Q data into an E443xB E4438C E8267C or E8267D signal generator It reads the I and Q data from a binary data file and then writes the data to the instrument Include the standard ...

Страница 276: ...e to check your data in this way before attempting to write it to the instrument char ofile c SignalGenerator data iq txt Create arrays to hold the I and Q data int idata MAXSAMPLES int qdata MAXSAMPLES Often we must modify scale or offset the data before loading it into the instrument These buffers are used for that purpose Since each sample is 16 bits and a character only holds 8 bits we must ma...

Страница 277: ...es If your data is in some other format then replace this block with appropriate code for reading your format First read I values done false index 0 infile fopen ifile rb if infile NULL perror Error opening file to read while done i1 fgetc infile read the first byte if i1 EOF break i2 fgetc infile read the next byte if i2 EOF break ivalue i1 i2 256 put the two bytes together note that the above fo...

Страница 278: ...g endian processor such as Motorola HP or Sun qdata index ivalue if index MAXSAMPLES break fclose infile Remember the number of samples which were read from the file numsamples index Print the I and Q values to a text file If you are having trouble look in the file and see if your I and Q data looks correct Plot the data from this file if that helps you to diagnose the problem FILE outfile fopen o...

Страница 279: ...this is not the scaling of your data then you will need to scale your data appropriately in the next two blocks ibuffer and qbuffer will hold the data in the E443xB format No scaling is needed however we need to swap the byte order on a little endian computer Remove the byte swapping if you are using a big endian computer for index 0 index numsamples index int ivalue idata index int qvalue qdata i...

Страница 280: ...hange the signal generator scaling to 100 Also we need to swap the byte order on a little endian computer This code also works for big endian order data since it swaps bytes based on the order for index 0 index numsamples index int iscaled 2 8 idata index 8192 shift and scale int qscaled 2 8 qdata index 8192 shift and scale iqbuffer index 4 iscaled 8 0xFF high byte of i iqbuffer index 4 1 iscaled ...

Страница 281: ...s Part 1 MEM DATA filename Part 2 length of Part 3 when written to a string Part 3 length of the data in bytes This is in s from above Part 4 the buffer of data Build parts 1 2 and 3 for the I data sprintf cmd MEM DATA ARBI FILE1 d d strlen s bytesToSend Send parts 1 2 and 3 iwrite id cmd strlen cmd 0 0 Send part 4 Be careful to use the correct command here In many programming languages there are ...

Страница 282: ... bits to be used However this format is not accepted in the E443xB Therefore do not use this next section for the E443xB printf Note Loading FILE2 on a E443xB will cause ERROR 208 I O error n Identical to the I and Q sections above except a The I and Q data are interleaved b The buffer of I Q is twice as long as the I buffer was c The SCPI command uses WFM1 instead of ARBI and ARBQ bytesToSend num...

Страница 283: ... unsigned __int64 uint64 endif WIN32 static const int NUM_DAC_BITS 16 static const int DAC_MAX 1 NUM_DAC_BITS calculates the rms of a chunk of a waveform stored as 16 bit alternating I Q twos complement DAC values NOTE short must be a 16 bit quantity Also NOTE For 4Gsa or more samples must be an int64 double calcRmsWaveformSegment const signed short iq_data unsigned samples a double cannot hold th...

Страница 284: ...AB Programming Examples This section contains the following programming examples Creating and Storing I Q Data on page 284 Creating and Downloading a Pulse on page 289 Downloading a Waveform Markers and Setting the Waveform Header on page 291 Playing Downloaded Waveforms on page 299 Creating and Storing I Q Data On the documentation CD this programming example s name is offset_iq_ml m This MATLAB ...

Страница 285: ... to 1 Create a simple IQ waveform 2 Save the waveform into the EXG MXG Internal Arb format This format is for the N5182B 3 Load the internal Arb format file into a MatLab array 1 Create Simple IQ Signal This signal is a single tone on the upper side of the carrier and is usually refered to as a Single Side Band Suppressed Carrier SSBSC signal It is nothing more than a cosine wavefomm in I and a si...

Страница 286: ...value of the DAC 0 Zero out of the DAC 32767 Maximum negative value of the DAC The internal arb expects the data bytes to be in Big Endian format This is opposite of how short integers are saved on a PC Little Endian For this reason the data bytes are swapped before being saved Interleave the IQ data waveform 1 2 2 points Iwave waveform 2 2 2 points Qwave Iwave Qwave waveform waveform Normalize th...

Страница 287: ...tegers However the acual bit pattern is that of signed short integers and that is how the ESG PSG interprets them filename C Temp EsgTestFile FID message fopen filename w Open a file to write data if FID 1 error Cannot Open File end fwrite FID waveform unsigned short write to the file fclose FID close the file 3 Load the internal Arb format file This process is just the reverse of saving the wavef...

Страница 288: ...ray If on a PC swap the bytes back to Little Endian if strcmp computer PCWIN Put the bytes into the correct order internalWave bitor bitshift internalWave 8 bitshift bitand internalWave 255 8 end convert unsigned to signed representation internalWave double internalWave tmp internalWave 32767 0 65536 iqWave internalWave tmp 32767 and normalize the data De Interleave the IQ data IwaveIn iqWave 1 2 ...

Страница 289: ...end set the carrier frequency and power level on the signal generator using the Keysight Waveform Download Assistant status status_description agt_sendcommand io SOURce FREQuency 6000000000 status status_description agt_sendcommand io POWer 0 define the ARB sample clock for playback sampclk 40000000 download the iq waveform to the baseband generator for playback status status_description agt_wavef...

Страница 290: ...l using linear FM chirp to the 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 KHz Bessel null of dev rate 2 404 to the vector signal generator nchirp m This programming example calculates and downloads an arbitrary waveform file that simulates a simple compressed...

Страница 291: ...arkers header Copyright 2009 Keysight Technologies Inc This function downloads a waveform and markers to an Keysight X Series signal generator X Series Vector Signal Generator markers is a two dimentional array that contains 4 markers The header contains the sample rate the waveform rms voltage and the marker routings to the pulse modulator and the ALC hold Default values used by the header if val...

Страница 292: ...rm name 21 characters max iqWave Complex waveform min length 60 points markers markers 4 length iqWave 4 possible markers header Structure containing waveform information OUTPUT PARAMETERS EXAMPLES name My_Test Waveform name tcpipAddress 141 121 151 129 Signal Generator IP Address n 1000 Points in waveform phase 102 pi n 0 n 1 iqWave complex cos phase sin phase Create single tone markers zeros 4 n...

Страница 293: ... markers zeros 4 length iqWave markers 1 4 1 end if nargin 5 header end if length iqWave length markers error ERROR download The length of the iqWave and the marker arrays must be the same end Process waveform and marker data iqData rms FormatWaveform iqWave mkrData FormatMarkers markers Download the Waveform wfmCmd CreateWaveformCommand name length iqWave mkrCmd CreateMarkerCommand name length ma...

Страница 294: ...eform WriteData t iqData 2 bufSize fprintf t n fprintf t syst err fgets t fprintf t s mkrCmd fwrite t mkrData int8 WriteData t mkrData 1 bufSize fprintf t n fprintf t syst err fgets t fprintf t s n hdrCmd fprintf t syst err fgets t fclose t end function WriteData fid data format bufSize Write data using a loop to support large waveforms without having to specify a huge buffer INPUT PARAMETERS fid ...

Страница 295: ...32 if format 1 sfmt int8 elseif format 2 sfmt int16 end stop 0 for i 0 fullChunks 1 start 1 i buf stop i 1 buf fwrite fid data start stop sfmt end if partialChunk 0 fwrite fid data stop 1 end sfmt end end function data rms FormatWaveform iqWave Scale the waveform to DAC values a b size iqWave if a b iqWave iqWave end maxV max abs real iqWave imag iqWave if maxV 0 maxV 1 end Prevent divide by zero ...

Страница 296: ...e pw length iqWave rms rms dutyCycle Interlace the I Q vectors data real iqWave imag iqWave data data end function mkr FormatMarkers markers The markers are placed in the 4 LSBs of a byte in this order M4 M3 M2 M1 c d size markers if c d markers markers c d size markers end mkr markers 1 0 if c 1 mkr mkr 2 markers 2 0 end if c 2 mkr mkr 4 markers 3 0 end if c 3 mkr mkr 8 markers 4 0 end end functi...

Страница 297: ...rms rms hdr peak 1 414 hdr runtimeScaling 70 In percent hdr pulse None hdr alcHold None hdr description Keysight Technologies if isempty header if isstruct header if isfield header sampleRate hdr sampleRate header sampleRate end if isfield header rms hdr rms header rms end if isfield header peak hdr peak header peak end if isfield header runtimeScaling hdr runtimeScaling header runtimeScaling end ...

Страница 298: ...wfmCmd CreateWaveformCommand file_name points MMEM DATA file_name ABC file_name the I Q file name and file path within the signal generator indicates the start of the data block A the number of decimal digits present in B B a decimal number specifying the number of data bytes to follow in C B num2str 4 points Bytes in waveform A num2str length B wfmCmd MEM DATA UNPR WFM1 file_name A B end function...

Страница 299: ...ipAddress name Copyright 2009 Keysight Technologies Inc Play the waveform in the Signal Generator INPUT PARAMETERS tcpipAddress 141 121 148 188 Whatever works for your signal Generator name Waveform name 21 characters max EXAMPLE name My_Test Waveform name tcpipAddress 141 121 151 129 Signal Generator IP Address PlayWaveform tcpipAddress name play the waveform playCmd RAD ARB WAV WFM1 name t tcpip...

Страница 300: ...300 Keysight CXG EXG and MXG X Series Signal Generators Programming Guide Creating and Downloading Waveform Files Programming Examples fopen t fprintf t s n playCmd fprintf t syst err fgets t fclose t ...

Страница 301: ...the file to the signal generator using FTP see FTP Procedures on page 231 Program Name Create_IQData Program Description This program creates a sine and cosine wave using 200 I Q data samples Each I and Q value is represented by a 2 byte integer The sample points are calculated scaled using the AMPLITUDE constant of 32767 and then stored in an array named iq_data The AMPLITUDE scaling allows for f...

Страница 302: ...egers for the waveform AMPLITUDE 32767 Scale the amplitude for full range of the signal generators I Q modulator DAC pi 3 141592 Dim intIQ_Data 0 To 2 SAMPLES 1 Array for I and Q integers 400 ReDim iq_data 0 To 4 SAMPLES 1 Need MSB and LSB bytes for each integer value 800 Create an integer array of I Q pairs For index 0 To SAMPLES 1 intIQ_Data 2 index CInt AMPLITUDE Sin 2 pi index SAMPLES intIQ_Da...

Страница 303: ...Src 1 2 Get the first two hex values MSB loHex Mid strSrc 3 2 Get the next two hex values LSB loByte CByte H loHex Convert to byte data type LSB hiByte CByte H hiHex Convert to byte data type MSB iq_data 2 index hiByte MSB into first byte iq_data 2 index 1 loByte LSB into second byte Next index Now write the data to the file FileHandle FreeFile Get a file number numPoints UBound iq_data Get the nu...

Страница 304: ...page 301 into non volatile memory using a LAN connection To use GPIB replace the instOpenString object declaration with GPIB 19 INSTR To download the data into volatile memory change the instDestfile declaration to USER BBG1 WAVEFORM This 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 Progra...

Страница 305: ...u must reference the Keysight VISA COM Resource Manager and VISA COM 1 0 Type Library in your Visual Basic project in the Project References menu The VISA COM 1 0 Type Library corresponds to VISACOM tlb and the Keysight VISA COM Resource Manager corresponds to AgtRM DLL The VISA COM 488 2 Formatted I O 1 0 corresponds to the BasicFormattedIO dll Use a statement such as Dim Instr As VisaComLib Form...

Страница 306: ...pen TCPIP0 000 000 000 000 Dim data As Byte Dim iq_data As Byte Dim FileHandle As Integer Dim numPoints As Integer Dim index As Integer Dim Header As String Dim response As String Dim hiByte As String Dim loByte As String Dim strFilename As String strFilename C IQ_DataVB File Name and location on PC Data will be saved to the signal generator s NVWFM USER WAVEFORM IQ_DataVB directory FileHandle Fre...

Страница 307: ...error For index 0 To numPoints 1 Write the IQ_DataVB data to the iq_data array Get FileHandle index 1 data index 1 is the record number iq_data index data Next index Close FileHandle Close the file Write the command to the Header string NOTE syntax Header MEM DATA USER WAVEFORM IQ_DataVB Now write the data to the signal generator s non volatile memory NVWFM SigGen WriteIEEEBlock Header iq_data Sig...

Страница 308: ...tation CD this programming example s name is hpbasicWin txt The following program will download a waveform using HP Basic for Windows into volatile ARB memory The waveform generated by this program is the same as the default SINE_TEST_WFM waveform file available in the signal generator s This code is similar to the code shown for BASIC for UNIX but there is a formatting difference in line 130 and ...

Страница 309: ...ted 120 Nbytes 4 Num_points 130 ASSIGN PSG TO 719 140 ASSIGN PSGb TO 719 FORMAT MSB FIRST 150 Nbytes VAL Nbytes 160 Ndigits LEN Nbytes 170 Ndigits VAL Ndigits 180 WAIT 1 190 OUTPUT PSG USING K MMEM DATA WFM1 data_file 200 OUTPUT PSG USING K Ndigits 210 OUTPUT PSG USING K Nbytes 220 WAIT 1 230 OUTPUT PSGb Int_array 240 OUTPUT PSG END 250 ASSIGN PSG TO 260 ASSIGN PSGb TO 270 PRINT 280 PRINT END 290 ...

Страница 310: ... 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 130 Opens an IO 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 IO path is used to send ASCII data to the signal generator 140 Opens an IO p...

Страница 311: ... 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 I INT 32767 COS I 360 Num_points 100 NEXT I 110 PRINT Data generated 120 Nbytes 4 Num_points 130 ASSIGN PSG TO 719 FORMAT ON 140 ASSIGN PSGb TO 719 FORMAT OFF 150 Nbytes VAL Nbytes 160 Ndigits LEN Nbytes 170 Nd...

Страница 312: ...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 130 Opens an IO 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...

Страница 313: ...ut 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 ARB_IQ_Win_file 20 Num_points 200 30 ALLOCATE INTEGER Iwfm_data 1 Num_points Qwfm_data 1 Num_points 40 DEG 50 FOR I 1 TO Num_points 60 Iwfm_data I INT 8191 SIN I 360 Num_points 8192 70 Qwfm_data I INT 8191 CO...

Страница 314: ...data The variable Nbytes is set to equal the number of bytes in the I waveform data This should be twice the number of integers in Iwfm_data since an integer is represented 2 bytes Input integers must be between 0 and 16383 In the Output commands USING K formats the data The pound symbol suppresses the automatic EOL End of Line output This allows multiple output commands to be concatenated as if t...

Страница 315: ...oints 110 ASSIGN Esg TO 719 FORMAT ON 120 ASSIGN Esgb TO 719 FORMAT OFF 130 Nbytes VAL Nbytes 140 Ndigits LEN Nbytes 150 Ndigits VAL Ndigits 160 OUTPUT Esg USING K MMEM DATA ARBI file_name_1 170 OUTPUT Esg USING K Ndigits 180 OUTPUT Esg USING K Nbytes 190 OUTPUT Esgb Iwfm_data 200 OUTPUT Esg END 210 OUTPUT Esg USING K MMEM DATA ARBQ file_name_1 220 OUTPUT Esg USING K Ndigits 230 OUTPUT Esg USING K...

Страница 316: ...form points Sets them to be integer arrays 40 Sets HP BASIC to use degrees for cosine and sine functions 50 Sets up loop to calculate waveform points 60 Calculates I waveform points 70 Calculates Q waveform points 80 End of loop 160 and 210 The I and Q waveform files have the same name 90 to 300 See the table on page 312 for program comments Program Comments Continued ...

Страница 317: ... encrypted file to the instrument For more information see Encrypted I Q Files and the Securewave Directory on page 226 ERROR 629 File format invalid The signal generator requires a minimum of 60 samples to build a waveform and the same number of I and Q data points ERROR 321 Out of memory There is not enough space in the ARB memory for the waveform file being downloaded To solve the problem eithe...

Страница 318: ...on page 30 and the User s Guide For additional SCPI command information refer to the SCPI Command Reference If the default marker is used toggle the Pulse RF Blank None softkey to None For more information on markers refer to Marker File on page 214 SCPI commands SOURce RADio 1 ARB MDEStination PULSe NONE M1 M2 M3 M4 SOURce RADio 1 ARB MDEStination PULSe Select Dual Arb More Marker Utilities on X ...

Страница 319: ...t Binary Downloads on page 327 Pattern RAM PRAM Data Downloads on page 346 FIR Filter Coefficient Downloads on page 360 Using the Equalization Filter on page 364 Save and Recall Instrument State Files on page 365 User Flatness Correction Downloads Using C and VISA on page 379 Data Transfer Troubleshooting on page 384 The following sections and procedures contain remote SCPI commands For front pane...

Страница 320: ...frame for framed data If there are not enough bits to fill a frame the signal generator truncates the data and repeats the file from the beginning PRAM With this file type the user provides the payload data along with the bits to control signal attributes such as bursting This file type is available for only the real time Custom and TDMA modulation formats FIR Filter This file type stores user cre...

Страница 321: ... volatile Storage memory where files survive cycling of the signal generator power Files remain until overwritten or deleted Refer to Table on page 322 for the file types that share this memory User FIR references are only applicable to vector signal generator models with an installed baseband generator option Table 6 1 Signal Generators and Volatile Memory File Types Volatile Memory Type Signal G...

Страница 322: ...p List x x User PRAM x User Binary x x User Bit x User FIR x x Instrument State x x Waveform Sequences multiple I Q files played together x x FIR STATE USERFLAT USER BBG1 Volatile memory directory WAVEFORM PRAM Root directory Volatile memory data Keysight X Series signal generator Internal WFM1 BIN i e Nonvolatile memory Storage media NONVOLATILE Keysight MXG1 1 This NONVOLATILE directory shows th...

Страница 323: ... memory i e internal storage or to the USB media if available The Keysight X Series signal generator non volatile internal memory is allocated according to a Microsoft compatible file allocation table FAT file system The signal generator allocates non volatile memory in clusters according to the drive size see Table 6 3 For example referring to Table 6 3 if the drive size is 15 MB and if the file ...

Страница 324: ...and the size of the other files that share the memory The baseband generator BBG options contain the volatile memory Table 6 4 shows the maximum available memory assuming that there are no other files residing in memory 512 MB 1023 MB 16k 1024 MB 2048 MB 32K 2048 MB 4096 MB 64K 4096 MB 8192 MB 128K 8192 MB 16384 MB 256K Table 6 3 Drive Size and Non volatile Memory Clusters Drive Size logical volum...

Страница 325: ...user data file is located within each user data file section Table 6 4 Maximum Signal Generator Memory Volatile WFM1 PRAM Memory Non Volatile NVWFM Memory Option Size Option Size N5166B 653 655 BBG 32 MSa 160 MB Standard 009 600 MSa 3 GB 7 5 GSa 30 GB 022 512 MSa 2 5 GB USB Flash Drive UFD user determined N5172B and N5182B 653 655 656 657 BBG 32 MSa 160 MB Standard 006 009 600 MSa 3 GB 2 GSa 8 GB ...

Страница 326: ...e query returns the following information memory used memory remaining file_names Table 6 5 User Data File Memory Location User Data File Type Download Memory Access Memory Bit Non volatile Volatile Binary Non volatile Volatile PRAM Volatile Volatile Instrument State Non volatile Non volatile FIR Non volatile Non volatile Flatness Non volatile Non volatile The signal generator calculates the memor...

Страница 327: ...our file needs to contain enough bits to fill a frame or timeslot or multiple frames or timeslots to end on the desired boundary To accomplish this you may have to remove or add bytes If there are not enough bits remaining in the file to fill a frame or timeslot the signal generator truncates the data causing a discontinuity in the data pattern You download a user file to either the Bit or Binary ...

Страница 328: ...and and ignores the remaining bits This provides greater flexibility in designing a data pattern without the concern of using an even number of bytes as is needed with the binary file data format The following figure illustrates this concept The example in the figure shows the bit data SCPI command formatted to download three bytes of data but only 23 bits of the three bytes are designated as the ...

Страница 329: ... hex editor program FTP the file to your PC UNIX workstation For information on how to FTP a file see FTP Procedures on page 342 Even though the signal generator views the downloaded data on a bit basis it groups the data into bytes and when the designated number of bits is not a multiple of 8 bits the last byte into one or more 4 bit nibbles To make the last nibble the signal generator adds bits ...

Страница 330: ...l generator extrapolates bits 19 and 20 to complete the nibble it ignores these bits along with bits 21 through 24 As seen with the hex editor program the signal generator does not actually change the three bytes of data in the downloaded file For information on editing a file after downloading see Modifying User File Data on page 341 Hex value changes to 5A264 Designated bits MEM DATA BIT 3byte 1...

Страница 331: ...ple to use 16QAM modulation the user file needs to contain 32 bytes enough data to fill 16 states 4 times end on a symbol boundary create 64 symbols the signal generator requires a minimum of 60 symbols for unframed data To do the same with 32QAM requires a user file with 40 bytes When you do not use an even number of bytes the signal generator repeats the data in the same symbol where the data st...

Страница 332: ...to have an even number of bytes and enough bits to fill the data fields the file needs 87 bytes 696 bits This is enough data to fill two frames while maintaining the integrity of the data pattern as illustrated in the following figure For information on editing a file after downloading see Modifying User File Data on page 341 User File Size For Custom when the signal generator creates the signal i...

Страница 333: ... maintaining a copy of the original file in volatile memory It is the AUTOGEN_PRAM_1 file that contains the 32 bit words and accounts for most of the user file PRAM memory space If the transmission is using unframed data and there are not enough bits in the data file to create 60 symbols the signal generator replicates the data pattern until there is enough data for 60 symbols For example GSM uses...

Страница 334: ...y file sizes are shown in the following list Binary file 70 bytes 1024 bytes 1 memory block Bit file 80 bytes 1024 bytes 1 memory block Remember that a bit file includes a 10 byte file header 5 Calculate the total volatile memory occupied by the user file data Downloading User Files The signal generator expects bit and binary file type data to be downloaded as block data binary data in bytes The I...

Страница 335: ...e command line as shown above but instead resides in a binary file on the PC UNIX When the program executes the SCPI command the command line notifies the signal generator that it is going to receive block data of the stated size and to place the file in the signal generator file directory with the indicated name Immediately following the command execution the program downloads the binary file to ...

Страница 336: ...rs In this code we define the string length as 200 bytes 200 characters 5 Store the value of bytesToSend in string s For example if bytesToSend 2000 s 2000 sprintf is a standard function in C which writes string data to a string variable 6 Store the SCPI command syntax and parameters in the string cmd The SCPI command prepares the signal generator to accept the data strlen is a standard function i...

Страница 337: ...ad when it encounters the first zero END indicator in the data Method 2 where the program sends a fixed number of bytes and ignores any zeros in the data This is the method used in our program For your programming language you must find and use the equivalent of method two Otherwise you may only achieve a partial download of the user file data 9 Send the terminating carriage n as the last byte of ...

Страница 338: ... 131 21702 S 4 07 8g Y9 7 Since this command is file specific BIT there is no need to add the file path to the file name After execution of this command the signal generator creates a file in the bit directory memory catalog named new_file that contains 27 bytes Remember that the signal generator adds a 10 byte file header to a bit file When the signal generator uses this file it will recognize on...

Страница 339: ...le The following command downloads a file that contains 34 bytes MEM DATA BIN new_file 2347 S 4 07 8g Y9 7 Ru y3 _ l Table 6 8 Binary File Type Commands Command Type Command Syntax For Extraction SCPI MEMory DATA UNPRotected bin file_name datablock This downloads the file to the signal generator You can extract the file within the context of a program FTPa put file_name user bin file_name No extra...

Страница 340: ...wnloading User Data Files User File Data Bit Binary Downloads After execution of this command the signal generator creates a file in the Binary Bin directory memory catalog named new_file that contains 34 bytes For information on downloading block data see Downloading User Files on page 334 ...

Страница 341: ...n format on RADio CUSTom STATe On Modulating and Activating the Carrier Use the following commands to modulate the carrier and turn on the RF output For a complete listing of SPCI commands refer to the SCPI Command Reference FREQuency FIXed 2 5GHZ POWer LEVel 10 0DBM OUTPut MODulation STATe ON OUTPut STATe ON Modifying User File Data There are two ways to modify a file after downloading it to the ...

Страница 342: ...ify the file using a hex editor program If you need to decrease or increase the number of bits of interest change the file header hex value 3 FTP the file to the signal generator s BIT memory catalog directory FTP Procedures 80 Byte File From Signal Generator 02 80 hex 640 bits designated as bits of interest Modified File 80 Bytes to 88 Bytes 02 bd hex 701 bits designated as bits of interest Added...

Страница 343: ...nter the signal generator s hostname or IP address in the URL http host name or IP address 2 Click the Signal Generator FTP Access button located on the left side of the window The signal generator files appear in the web browser s window 3 Drag and drop files between the PC and the browser s window For more information on the web server feature refer to the Programming Guide Using the Command Win...

Страница 344: ...his capability exists in only the Custom format when using a continuous data stream This means that it does not apply to a downloaded PRAM file type covered later in this chapter In parallel mode for a 256QAM modulation scheme Custom has the capability to reach a data rate of up to 400 Mbps The FIR filter width is what determines the data rate The following table shows the maximum data rate for ea...

Страница 345: ...100Mbps 2bps 50Mbps 2bps 25Mbps IS95 OQPSK QPSK P4DQPSK IS95 QPSK GRAYQPSK 4QAM D8PSK EDGE 8FSK 8PSK 3bps 150Mbps 3bps 75Mbps 3bps 37 5Mbps 16FSK 16PSK 16QAM 4bps 200Mbps 4bps 100Mbps 4bps 50Mbps Q32AM 5bps 250Mbps 5bps 125Mbps 5bps 62 5Mbps 64QAM 6bps 300Mbps 6bps 150Mbps 6bps 75Mbps 128QAM 7bps 350Mbps 7bps 175Mbps 7bps 87 5Mbps 256QAM 8bps 400Mbps 8bps 200Mbps 8bps 100Mbps Modulation Type Bit R...

Страница 346: ...s the remaining control bits when it generates the signal You download the file using either a list or block data format Programs such as MATLAB or MathCad can generate the data This type of signal control enables you to design experimental or proprietary framing schemes After selecting the PRAM file the signal generator builds the modulation scheme by reading data stored in PRAM and constructing ...

Страница 347: ...h pattern which is needed for downloading data using the list format shown on page 351 User File Data Byte MSB Data bits PRAM File Data Byte 1 1 0 1 0 1 0 1 Control bits Data bit LSB 1 0 0 1 1 1 0 1 MSB LSB Table 6 9 PRAM Data Byte Bit Function Value Comments 0 Data 0 1 This is the data bit It is unspecified when burst bit 2 is set to 0 1 Reserved 0 Always 0 2 Burst 0 1 1 RF on 0 RF off For non bu...

Страница 348: ... rate and filter settings and requires compensation to advance the burst bit in the downloaded PRAM file Table 6 10 PRAM Byte Patterns and Bit Positions Bit Function Pattern Reset EVENT 1 Output Reserved Bit 0 Reserved Bit 1 Reserved Bit 0 Burst Reserved Bit 0 Data Bit Pattern Decimal Value Bit Position 7 6 5 4 3 2 1 0 Bit Pattern 1 1 0 1 0 1 0 1 213 1 1 0 1 0 1 0 0 212 1 1 0 1 0 0 0 1 209 1 1 0 1...

Страница 349: ... contains 89 bytes data bits plus 7 control bits per data bit 89 bytes 89 x 24 bits 8 356 bytes Because the file downloads one fourth of the translated 32 bit word another method to calculate the file size is to multiply the downloaded file size by four 89 bytes x 4 356 bytes See also Signal Generator Memory on page 321 and Checking Available Memory on page 325 Minimum File Size A PRAM file requir...

Страница 350: ...ile replications The signal generator rounds this real value up to the next highest integer In this example the signal generator replicates the fourteen 32 bit words 56 bytes by a factor of 5 which makes the final file size 280 bytes This equates to a 70 byte file 14 bytes x 5 70 bytes 70 70 x 24 8 280 bytes Or 56 bytes x 5 280 bytes File size increases by a factor of 5 ...

Страница 351: ...tributes creates a file named new_file outputs a single pulse at the EVENT 1 connector bursts the data pattern 1100 seven times over 28 bytes transmits 32 non bursted bytes resets the data pattern so it starts again MEMory DATA PRAM FILE LIST new_file 85 21 20 20 21 21 20 20 21 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 1...

Страница 352: ... start of the block data A the number of decimal digits present in B B a decimal number specifying the number of data bytes to follow in C C the PRAM file data in bytes my_file the PRAM file name as it will appear in the signal generator s WFM1 memory catalog indicates the start of the block data 3 B has three decimal digits 240 240 bytes of data to follow in C 12 S 4 07 8g Y9 7 the ASCII represen...

Страница 353: ...r bytesToSend 0 0 iwrite id n 1 1 0 Line Code Description Download PRAM File Data 1 Define an integer variable bytesToSend to store the number of bytes to send to the signal generator 2 Store the total number of PRAM bytes in the integer variable defined in line 1 numbytes contains the length of the databuffer array referenced in line 8 3 Create a string large enough to hold the bytesToSend value ...

Страница 354: ...red in the array databuffer to the signal generator iwrite sends the data specified in databuffer PRAM data to the signal generator session identifier specified in id The third argument of iwrite bytesToSend contains the length of the databuffer in bytes In this example it is 240 The fourth argument of iwrite 0 means there is no END of file indicator in the data In many programming languages there...

Страница 355: ...wnloading User Data Files Pattern RAM PRAM Data Downloads RADio CUSTom DATA PRAM file_name Because the command is file specific PRAM there is no need to include the file path with the file name 3 Configure the remaining signal parameters 4 Turn the modulation format on RADio CUSTom STATe On ...

Страница 356: ... file_name variable Command Syntax The first file_name variable is the current location of the file and its name the second file_name variable is the destination to store the file and its name There are three ways to format the file_name variable to include the file path Extracting a PRAM File When you extract a PRAM file you are extracting the translated 32 bit word per byte file You cannot extra...

Страница 357: ...ile path as shown in the following tables There are two commands for file extraction MEM DATA file_name MMEM DATA filename The following table uses the first command to illustrate the command format however the format is the same if you use the second command Ensure that you do not use the MEMory DATA PRAM FILE BLOCk command to download an extracted file If you use this command the signal generato...

Страница 358: ...pe Command Syntax Options SCPI volatile memory MEM DATA UNPRotected WFM1 file_name blockdata MEM DATA UNPRotected file_name WFM1 blockdata MEM DATA UNPRotected user bbg1 waveform file_name blockdata SCPI non volatile memory MEM DATA UNPRotected NVWFM file_name blockdata MEM DATA UNPRotected file_name NVWFM blockdata MEM DATA UNPRotected user waveform file_name blockdata FTP volatile memorya put fi...

Страница 359: ...ding User Data Files Pattern RAM PRAM Data Downloads translates the data bit into a 32 bit word the file contents are not recognizable and therefore not editable using a hex editor program as shown in the following figure 60 byte PRAM file prior to downloading 60 byte PRAM file after downloading ...

Страница 360: ...rators support both Real and Complex filters Complex filters can only be used with equalization filters Refer to Table and to Table For more on equalization filters refer to Using the Equalization Filter on page 364 Filter lengths of up to 1024 taps are allowed The oversample ratio OSR is the number of filter taps per symbol Oversample ratios from 1 through 32 are possible If you encounter problem...

Страница 361: ...Mory DATA FIR file_name REAL osr coefficient MEMory DATA FIR file_name COMPlex osr realCoefficient imaginaryCoeffic ient Use the following SCPI command line to query list data from the FIR file MEMory DATA FIR file_name Sample Command Line The following SCPI command will download a typical set of real modulation FIR filter coefficient values and name the file FIR1 MEMory DATA FIR FIR1 4 0 0 0 0 0 ...

Страница 362: ...le ratio 0 0 0 0 0 0 000001 the FIR filter coefficients Selecting a Downloaded User FIR Filter as the Active Filter FIR Filter Data for Custom Modulation The following remote command selects user FIR filter data as the active filter for a custom modulation format RADio CUSTom FILTer file_name This command selects the user FIR filter specified by the file name as the active filter for the custom mo...

Страница 363: ...dulating and Activating the Carrier The following commands set the carrier frequency and power and turns on the modulation and the RF output 1 Set the carrier frequency to 2 5 GHz FREQuency FIXed 2 5GHZ 2 Set the carrier power to 10 0 dBm POWer LEVel 10 0DBM 3 Activate the modulation OUTPut MODulation STATe ON 4 Activate the RF output OUTPut STATe ON ...

Страница 364: ...ted to the center 256 taps The equalization filter operates at 125MHz 200MHz for N5166B 72B 82B so all equalization filters must be resampled to 125MHz 200MHz for N5166B 72B 82B prior to selection if they are sampled at some other rate The signal generator supports equalization filters either Complex or Real that are programmable FIR filters with two inputs I Q and two outputs I Q per sample This ...

Страница 365: ...orm file associated with it store the file For example if you are editing a multitone arb format store the multitone data to a file in the signal generator s memory catalog multitone files are stored in the USER MTONE directory Then save the instrument state associated with that data file The settings for the signal generator such as frequency and amplitude and a reference to the multitone file na...

Страница 366: ... the user for an action Backup State Files Restore State Files or Quit The Backup State Files choice reads the signal generator s state files and stores it on your computer in the same directory where the State_Files exe program is located The Restore State Files selection downloads instrument state files stored on your computer to the signal generator s State directory The Quit selection exists t...

Страница 367: ... to run the State_Files program 1 Copy the State_Files cs file from the CD ROM programming examples section to the directory where the NET Framework is installed 2 Change the TCPIP0 address in the program from TCPIP0 000 000 000 000 to your signal generator s address 3 Save the file using the cs file name extension 4 Run the Command Prompt program Start Run cmd exe Change the directory for the com...

Страница 368: ...cation that uses DLL importing to allow for calls to the unmanaged Keysight IO Library VISA DLL The Keysight VISA library must be installed on your computer for this example to run Important Replace the visaOpenString with the IP address for your signal generator using System using System IO using System Text using System Runtime InteropServices using System Collections using System Text RegularEx...

Страница 369: ... The main entry point for the application STAThread static void Main string args uint defaultRM Open the default VISA resource manager if VisaInterop OpenDefaultRM out defaultRM 0 If no errors proceed uint device Open the specified VISA device the signal generator if VisaInterop Open defaultRM visaOpenString VisaAccessMode NoLock DEFAULT_TIMEOUT out device 0 if no errors proceed bool quit false wh...

Страница 370: ...ite instrument state break files to the computer case 2 RestoreInstrumentState device Read instrument state break files to the sig gen case 3 quit true break default break VisaInterop Close device Close the device else Console WriteLine Unable to open visaOpenString VisaInterop Close defaultRM Close the default resource manager else Console WriteLine Unable to open the VISA resource manager ...

Страница 371: ...Files di GetFiles STA Get the state files foreach FileInfo fi in rgFiles Match m Regex Match fi Name d _ d d if m Success string sequence m Groups 1 ToString string register m Groups 2 ToString Console WriteLine Restoring sequence sequence register register Save the target instrument s current state to the specified sequence register pair This ensures the index file has an entry for the specified ...

Страница 372: ...ublic void BackupInstrumentState uint device Get the memory catalog for the state directory WriteDevice device MEM CAT STAT n false string catalog ReadDevice device Match the catalog listing for state files which are named sequence _ register e g 0_01 1_01 2_05 Match m Regex Match catalog d_ d d while m Success Grab the matched filename from the regular expresssion string nextFile m Groups 1 ToStr...

Страница 373: ...e END line will not be sent static public void WriteDevice uint device string scpiCmd bool sendEnd byte buf Encoding ASCII GetBytes scpiCmd if sendEnd Do not send the END line character VisaInterop SetAttribute device VisaAttribute SendEndEnable 0 uint retCount VisaInterop Write device buf uint buf Length out retCount if sendEnd Set the bool sendEnd true VisaInterop SetAttribute device VisaAttribu...

Страница 374: ...tic public void ReadFileBlock uint device string fileName Create the new empty data file FileStream fs new FileStream fileName FileMode Create Read the definite block header lengthDataLength dataLength uint retCount 0 byte buf new byte 10 VisaInterop Read device buf 2 out retCount VisaInterop Read device buf uint buf 1 0 out retCount uint fileSize UInt32 Parse Encoding ASCII GetString buf 0 int re...

Страница 375: ...ic public void WriteFileBlock uint device string fileName Make sure that the file exists otherwise sends a null block if File Exists fileName FileStream fs new FileStream fileName FileMode Open Send the definite block header lengthDataLength dataLength string fileSize fs Length ToString string fileSizeLength fileSize Length ToString WriteDevice device fileSizeLength fileSize false Don t set END at...

Страница 376: ...erop SetAttribute device VisaAttribute SendEndEnable 1 Done with file fs Close else Send an empty definite block WriteDevice device 10 false Declaration of VISA device access constants public enum VisaAccessMode NoLock 0 ExclusiveLock 1 SharedLock 2 LoadConfig 4 Declaration of VISA attribute constants public enum VisaAttribute SendEndEnable 0x3FFF0016 TimeoutValue 0x3FFF001A This class provides a ...

Страница 377: ...int Close uint session DllImport agvisa32 dll EntryPoint viFindNext public static extern int FindNext uint findList byte desc DllImport agvisa32 dll EntryPoint viFindRsrc public static extern int FindRsrc uint session string expr out uint findList out uint retCnt byte desc DllImport agvisa32 dll EntryPoint viGetAttribute public static extern int GetAttribute uint vi VisaAttribute attribute out uin...

Страница 378: ...a32 dll EntryPoint viRead public static extern int Read uint session byte buf uint count out uint retCount DllImport agvisa32 dll EntryPoint viSetAttribute public static extern int SetAttribute uint vi VisaAttribute attribute uint attrState DllImport agvisa32 dll EntryPoint viStatusDesc public static extern int StatusDesc uint vi int status byte desc DllImport agvisa32 dll EntryPoint viWrite publi...

Страница 379: ...de values are entered through the keyboard and displayed on the console interface The values are then downloaded to the signal generator and stored to a file named flatCal_data The file is then loaded into the signal generator s memory catalog and corrections are turned on The figure below shows the console interface and several frequency and amplitude values Use the same format shown in the figur...

Страница 380: ...uency and amplitude correction pairs to the signal generator The program asks the operator to enter the number of pairs and allocates a pointer array listPairs sized to the number of pairs The array is filled with frequency nextFreq and amplitude nextPower values entered from the keyboard IMPORTANT Replace the 000 000 000 000 IP address in the instOpenString declaration in the code below with the ...

Страница 381: ...Session defaultRM vi ViStatus status 0 status viOpenDefaultRM defaultRM open the default resource manager TO DO Error handling here status viOpen defaultRM instOpenString VI_NULL VI_NULL vi if status if any errors then display the error and exit the program fprintf stderr viOpen failed s n instOpenString return 1 printf Example Program to Download User Flatness Corrections n n printf Enter number ...

Страница 382: ..._LENGTH 1 amplitude array enter frequency and amplitude pairs i e 10ghz 1db printf Enter Freq d i 1 scanf s nextFreq printf Enter Power d i 1 scanf s nextPower pairsList 2 i nextFreq frequency pairsList 2 i 1 nextPower power correction unsigned char str 256 buffer used to hold SCPI command initialize the signal generator s user flatness table sprintf char str corr flat pres n write to buffer viWri...

Страница 383: ...re s n fileName write to buffer viWrite vi str strlen char str 0 write the command to the PSG printf nFlatness Data saved to file s n n fileName load corrections sprintf char str corr flat load s n fileName write to buffer viWrite vi str strlen char str 0 write command to the PSG turn on corrections sprintf char str corr on n viWrite vi str strlen char str 0 printf nFlatness Corrections Enabled n ...

Страница 384: ... entirely fill the data field of each timeslot The user file must be a multiple of 8 bits so that it can be represented in ASCII characters Available volatile memory must be large enough to support both the data field bits and the framing bits This section applies to vector models with an installed baseband generator option Table 6 14 Use File Download Trouble Symptoms and Causes Symptom Possible ...

Страница 385: ...if the original data pattern s length is not a multiple of 8 you need to add bits to complete the ASCII character replicate the data pattern to generate a continuously repeating pattern with no discontinuity truncate the excess bits Using Externally Generated Real Time Data for Large Files When the data fields must be continuous data streams and the size of the data exceeds the available PRAM real...

Страница 386: ...st bit 2 is set to 0 1 Reserved 0 Always 0 2 Burst 0 1 1 RF on 0 RF off For non bursted non TDMA systems to have a continuous signal set this bit to 1 for all bytes For framed data set this bit 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 EVENT1 Output 0 1 To have the signal generator output a single pulse at the EVENT 1 connecto...

Страница 387: ...2 for Arb Custom Modulation filters and 256 for Equalization filters will not be selectable for the configuration Table 6 17 User FIR File Download Trouble Symptoms and Causes Symptom Possible Cause ERROR 321 Out of memory There is not enough memory available for the FIR coefficient file being downloaded To solve the problem either reduce the file size of the FIR file or delete unnecessary files f...

Страница 388: ...388 Keysight CXG EXG and MXG X Series Signal Generators Programming Guide Creating and Downloading User Data Files Data Transfer Troubleshooting ...

Страница 389: ...est interrupt 110 Sockets LAN programming 120 states saving and recalling 101 C and VISA GPIB queries 85 GPIB interface check 75 C C 22 C programming examples 64 remote control 22 VISA example 366 C programming examples 63 254 VISA generating a step swept signal 96 C and VISA generating a step swept signal 96 cable USB 60 carrier activating FIR filters 363 modulating FIR filters 363 Checking Avail...

Страница 390: ...file data 331 bit file data 328 user file data FTP procedures 342 unencrypted files for extraction 358 unencrypted files for no extraction 358 user flatness 365 utilities IntuiLink for signal generators 204 Keysight Signal Studio Toolkit 204 Waveform Download Assistant 204 waveform data advanced programming languages 243 commands 225 e443xb signal generator files 210 251 encrypted files for extrac...

Страница 391: ...ing 343 methods 226 procedures for downloading files 231 342 using 56 web server procedure 233 343 G Getting Started Wizard 38 global settings Keysight X Series 30 318 GPIB address 38 115 configuration 38 controller 39 interface 15 38 interface cards 36 67 IO libraries 21 Keysight X Series setting address 38 listener 39 overview 36 67 program examples 40 68 75 85 SCPI commands 39 talker 39 trouble...

Страница 392: ...le memory types 321 Waveform Download Assistant 250 IO Libraries Suite 16 Suite using interactive IO 47 version 15 0 17 version J 50 version M 19 50 59 psg memory allocation volatile memory 323 volatile memory types 321 Waveform Download Assistant 250 Signal Studio 250 Signal Studio Toolkit 204 VISA 21 40 59 68 VISA COM Resource Manager 1 0 64 X Series global settings configuration 30 global setti...

Страница 393: ...y checking 325 bit 325 FIR 325 flatness 325 instrument state 325 PRAM 325 locations 220 321 non volatile NVWFM 225 signal generator maximum 325 size 224 324 volatile and non volatile 321 memory usage user file data custom 333 TDMA 333 Microsoft NET Framework overview 367 Mini B 5 pin Rear panel connector 60 MSB 207 MSB and LSB 328 MS DOS Command Prompt 46 multiple of 8 bits requirement user file d...

Страница 394: ...11 115 programming guide content 11 Q queries HP Basic using 80 queue error 32 R real time data files generating large 385 rear panel connector Mini B 60 recall states 365 references content of 11 register system overview 168 data questionable See also data questionable registers registers See also data questionable registers See also status registers condition description 181 mxg overall system 1...

Страница 395: ...yers remote programming 14 libraries IO 16 SRE commands 176 SRQ command 174 SRQ method status registers 174 standard event status enable register 183 group 182 register 182 standard operation condition register 185 event enable register 186 event register 186 transition filters 185 state files 365 states saving and recalling using VISA and C 101 status byte group 179 mxg overall register system 17...

Страница 396: ...source 341 size 332 user FIR file downloads non volatile memory 361 selecting a downloaded user FIR file 362 user flatness 365 user data file type binary memory location 325 bit memory location 325 FIR memory location 325 flatness memory location 325 instrument state memory location 325 memory location 325 PRAM memory location 325 user data files See user data Using Connection Expert configuring a...

Страница 397: ...put values 209 data requirements 205 encrypted data 223 encryption 225 230 explained 206 extracting 225 228 229 I and Q interleaving 212 LSB and MSB 207 saving to a text file for review 237 waveform download utilities differences 250 waveform downloads advanced programming languages using 243 download utilities using 250 HP BASIC using 308 314 memory 220 allocation 222 323 size 224 324 volatile an...

Страница 398: ...This information is subject to change without notice Keysight Technologies 2012 2019 Edition 1 July 2019 N5180 90074 www keysight com ...

Отзывы: