1‘ MERGE "DECL.BAS" AS INSTRUCTED IN YOUR NATIONAL INSTRUMENTS GPIB-PC MANUAL

2

1000

‘ APPLICATION #3: CONTROLLING VOLTAGE RAMP UP AT TURN ON

1010

‘ FOR GWBASIC AND THE NATIONAL INSTRUMENTS GPIB-PC INTERFACE CARD

1020

‘ PROGRAM: N3.BAS

 

1030

 

1040

‘ CONFIGURE THE GPIB.COM HANDLER FOR THE FOLLOWING:

1050

 

1060

‘ EOI ENABLED FOR BOTH READ AND WRITE

 

1070

‘ DISABLE AUTO SERIAL POLL

 

1080

 

 

1090

‘ INSTRUMENT.NAME$ = "SLOTO"

 

1100

CALL IBFIND( INSTRUMENT.NAME$, SLOTO% )

 

1110

IF SLOTO% < 0 THEN PRINT “COULDN'T FIND MODULE" : STOP

1120

 

1130

OPTION BASE 1

 

1140

VSTEP$ = “”

‘ STRING TO HOLD THE VOLTAGE RAMP STEPS

1150

VSTART = 2

‘ START VOLTAGE FOR RAMP

1160

VSTOP = 10

‘ STOP VOLTAGE FOR RAMP

1170

RAMPTIME = .5

‘ TIME IN SECONDS TO CHANGE FROM VSTART TO VSTOP

1180

DWELL = RAMPTIME / 19

‘ DWELL TIME FOR EACH POINT

1190

 

1200

‘ SINCE THE OUTPUT STAYS AT THE LAST VOLTAGE POINT AFTER ITS DWELL TIME EXPIRES, THE DWELL TIME OF THE

1210

' LAST POINT IS NOT PART OF THE TRANSITION TIME. THEREFORE, DIVIDE THE TOTAL TIME BY 19 POINTS, NOT 20.

1220

' YOU WANT THE SAME DWELL TIME FOR EVERY POINT IN THE LIST, SO YOU NEED TO DOWNLOAD ONLY 1 DWELL TIME.

1230

'

 

1240

' SINCE THE NATIONAL INSTRUMENTS GPIB-PC WORKS WITH STRINGS, THE RAMP DATA MUST BE CONSOLIDATED INTO A

1250

' SINGLE STRING WHICH CONTAINS ALL THE POINTS, SEPARATED BY COMMAS.

1260

 

1270

FOR I=1 TO 20

‘ MAKES THE STRING EQUIVALENTS OF THE

1280

VSTEP$ = VSTEP$ + STR$( VSTART + ((( VSTOP - VSTART ) / 20 *I )) ‘ VOLTAGE POINTS AND CONCATENATES THEM ONLY

1290

IF I <> 20 THEN VSTEP$=VSTEP$+","

‘ FOR THE FIRST 19 POINTS, EACH FOLLOWED

1300

NEXT I

‘ BY A COMMA. THE LAST POINT IS NOT

1310

‘ FOLLOWED BY A COMMA.

1320

 

1330

CMD$ = "*RST;*CLS;STATUS:PRESET"

‘ RESET AND CLEAR MODULE

1340

CALL IBWRT( SLOTO%, CMD$ )

 

1350

IF IBSTA% < 0 THEN GOTO 1960

 

1360

 

1370

CMD$ = "VOLT “ + STR$( VSTART )

‘ START RAMP AT VSTART. USE NUMBER TO STRING

1380

CALL IBWRT( SLOTO%, CMD$ )

‘ CONVERSION TO SEND REAL NUMBERS OVER THE BUS

1390

IF IBSTA% < 0 THEN GOTO 1960

‘ AS PART OF THE COMMAND STRING.

1400

 

1410

CMD$ = "CURR .1"

 

1420

CALL IBWRT( SLOTO%, CMD$

 

1430

IF IBSTA% < 0 THEN GOTO 1960

 

1440

 

1450

CMD$ = "OUTPUT ON"

‘ ENABLE OUTPUT

1460

CALL IBWRT( SLOTO%, CMD$ )

 

1470

IF IBSTA% < 0 THEN GOTO 1960

 

1480

 

1490

CMD$ = "VOLT:MODE LIST"

‘ SET TO GET VOLTAGE FROM LIST

1500

CALL IBWRT( SLOTO%, CMD$ )

 

1510

IF IBSTA% < 0 THEN GOTO 1960

 

1520

 

1530

CMD$ = "LIST:VOLT “ + VSTEP$

‘ DOWNLOAD VOLTAGE LIST POINTS

1540

CALL IBWRT( SLOTO%, CMD$ )

 

1550

IF IBSTA% < 0 THEN GOTO 1960

 

1560

 

1570

CMD$ = "LIST:DWELL” + STR$(DWELL )

‘ DOWNLOAD 1 DWELL TIME. USE NUMBER TO STRING

102 Application Programs

Page 101
Image 101
Agilent Technologies 66lxxA manual ‘ Program N3.BAS, ‘ Disable Auto Serial Poll, ‘ INSTRUMENT.NAME$ = Sloto