Queries using ni-488.2 and visual c, Queries using ni- 488.2 and visual c – Agilent Technologies N5183A MXG User Manual

Page 83

Advertising
background image

Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide

73

Programming Examples

GPIB Programming Interface Examples

220 PRINT "Present 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 ! Print frequency mode to the controller display

320 PRINT "Source's frequency mode is: ";A$

330 PRINT

340 OUTPUT Sig_gen;"OUTP OFF" ! Turns signal generator RF state off

350 OUTPUT Sig_gen;"OUTP?" ! Querys the operating state of the signal generator

360 ENTER Sig_gen;B ! Enter in the state (0 for off)

370 ! Print the on/off state of the signal generator to the controller display

380 IF B>0 THEN

390 PRINT "Signal Generator output is: on"

400 ELSE

410 PRINT "Signal Generator output is: off"

420 END

IF

430 OUTPUT Sig_gen;"*IDN?" ! Querys for signal generator ID

440 ENTER Sig_gen;C$ ! Enter in the signal generator ID

450 ! Print the signal generator ID to the controller display

460 PRINT

470 PRINT "This signal generator is a ";C$

480 PRINT

490 ! The next command is a query for the signal generator's GPIB address

500 OUTPUT Sig_gen;"SYST:COMM:GPIB:ADDR?"

510 ENTER Sig_gen;D$ ! Enter in the signal generator's address

520 ! Print the signal generator's GPIB address to the controllers display

530 PRINT "The GPIB address is ";D$

540 PRINT

550 ! Print user prompts to the controller's display

560 PRINT "The signal generator is now under local control"

570 PRINT "or Press RUN to start again."

580 END

Queries Using NI-488.2 and 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 required files, and enter the following code into your .cpp source
file. niex3.cpp performs the following functions:

Advertising
This manual is related to the following products: