Application Programs 99
Supplemental Information
This appendix contains program listings translated into the following DOS-compatible languages and GPIB interfaces:
GWBASIC and the Agilent 61062/82990/82335A GPIB Command Library for MS-DOS
GWBASIC and the National Instruments GPIB-PC Interface Card
Microsoft C and the Agilent 61062/82990/82335A GPIB Command Library for MS-DOS
Microsoft C and the National Instruments GPIB-PC Interface Card
Each program is translated from the Agilent BASIC listing found in application #3. This example program was chosen as
representative of all application programs because it shows how to:
Configure the interface card.
Address the power module.
Write strings to the power module.
Write real arrays to the power module.
Receive real numbers from the power module.
The six other application programs all use a subset of the above functions.
1 ’ MERGE "SETUP.BAS" AS DESCRIBED IN YOUR GPIB COMMAND LIBRARY MANUAL
2
1000 ‘ APPLICATION #3: CONTROLLING VOLTAGE RAMP UP AT TURN ON
1010 ‘ FOR GWBASIC AND THE Agilent 61062/82990/82335A GPIB COMMAND LIBRARY
1020 ‘ PROGRAM: Agilent 3.BAS
1030 ‘
1040 OPTION BASE 1
1050 INTERFACE = 7 ‘ SELECT CODE OF THE GPIB CARD
1060 SLOTO 705001 ‘ SELECT CODE 7, MAINFRAME ADDRESS 05, SLOT 00
1070 CR.LFS CHR$(13) + CHR$(10) ‘ CARRIAGE RETURN + LINE FEED = END OF LINE TERMINATION
1080 DIM VSTEP(20) ‘ ARRAY TO HOLD THE VOLTAGE RAMP STEPS
1090 NUM.POINTS = 20 ‘ NUMBER OF POINTS IN THE VOLTAGE RAMP ARRAY
1100 VSTART = 2 ‘ START VOLTAGE FOR RAMP
1110 VSTOP = 10 ‘ STOP VOLTAGE FOR RAMP
1120 RAMPTIME = .5 ‘ TIME IN SECONDS TO CHANGE FROM VSTART TO VSTOP
1130 DWELL = RAMPTIME / 19 ‘ DWELL TIME FOR EACH POINT
1140 ‘
1150 ‘ SINCE THE OUTPUT STAYS AT THE LAST VOLTAGE POINT AFTER ITS DWELL TIME EXPIRES, THE DWELL TIME OF THE
1160 ‘ LAST POINT IS NOT PART OF THE TRANSITION TIME. THEREFORE, DIVIDE THE TOTAL TIME BY 19 POINTS, NOT 20.
1170 ‘ YOU WANT THE SAME DWELL TIME FOR EVERY POINT IN THE LIST, SO YOU NEED TO DOWNLOAD ONLY 1 DWELL TIME.
1180 ‘
1190 FOR I=1 TO 20
1200 VSTEP(I) = VSTART + ((( VSTOP - VSTART ) / 20 ) * I ) ‘ CALCULATES VOLTAGE LIST POINTS
1210 NEXT I
1220 ‘
1230 NOTE REGARDING GPIB READ/WRITE TERMINATIONS:
1240 ‘
1250 ‘ THE DEFAULT MODE OF THE INTERFACE CARD IS THAT EOI IS ENABLED AND THE READ/WRITES TERMINATE
1260 ‘ ON CARRIAGE RETURN/LINE FEED. THE MODULE TERMINATES ON EITHER EOI OR LINE FEED, SO THE
1270 ‘ DEFAULT SETTINGS OF THE CARD ARE SUFFICIENT.
1280 ‘
1290 CMD$ = "*RST;*CLS;STATUS:PRESET" ‘ RESET AND CLEAR MODULE
1300 L = LEN( CMD$ )
1310 CALL IOOUTPUTS( SLOTO, CMD$, L )
1320 IF PCIB.ERR<>0 THEN ERROR PCIB.BASERR
1330 ‘