06.08.2014 Views

(8.5x11) 6000 Manual Cover - Newport Corporation

(8.5x11) 6000 Manual Cover - Newport Corporation

(8.5x11) 6000 Manual Cover - Newport Corporation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

D.2 Example Program IEEE-488 Communication<br />

‘*********************** Program Header *******************************<br />

‘NEWPORT CORPORATION<br />

‘2832-C to IEEE-488 Communication Program - an example program<br />

‘<br />

‘The following program is designed to be an example of how to write a simple<br />

‘program that will write commands and read query responses to and from<br />

‘the 2832-C Dual-Channel Power Meter via the IEEE-488 port.<br />

‘<br />

‘This program was written on an IBM AT compatible using QuickBASIC 4.5<br />

‘ and software routines included with the GPIB board.<br />

‘The GPIB board used was: National Instruments GPIB-PC2A board<br />

‘ <strong>Newport</strong> <strong>Corporation</strong> pn LA-PC-488-2A-5<br />

‘The interface cable was:<br />

<strong>Newport</strong> <strong>Corporation</strong> pn LA-CABLE-2M488<br />

‘<br />

‘NOTE: Before running this program follow National Instrument’s instructions<br />

‘ for hardware and software installation. This program uses the GPIB<br />

‘ configuration device named DEV5 which uses GPIB address 5 by default.<br />

‘ All routines that begin with the letters “IB” are defined in the<br />

‘ National Instruments library.<br />

‘<br />

‘Written By: Darwin D. Smith<br />

‘ Date: April 28, 1993<br />

‘************************* End of Header ************************************<br />

‘Beginning of program<br />

‘$INCLUDE: ‘E:\b45\QBDECL.BAS’ ‘Use your own path here.<br />

‘Beginning of program<br />

IEEEout$ = “DEV5” ‘Use this name or assign a new one<br />

CALL IBFIND(IEEEout$, device.number%) ‘Setup the device.number% variable<br />

‘used in GPIB-PC routine calls.<br />

IF device.number% < 0 THEN<br />

PRINT “Unable to find “; IEEEout$; “ device.”<br />

STOP<br />

END IF<br />

GOSUB Main.Screen<br />

‘Draw header on the screen<br />

GOSUB Enter.User.Commands<br />

‘Process user input<br />

END ‘End of program<br />

‘Main.Screen: Draw the main screen.<br />

Main.Screen:<br />

CLS<br />

LOCATE 1, 22: PRINT “N E W P O R T C O R P O R A T I O N”<br />

LOCATE 2, 19: PRINT “2832-C to IEEE-488 Communication Program”<br />

LOCATE 3, 19: PRINT “<br />

Q or q to Quit”<br />

RETURN<br />

‘Enter.User.Commands: Get and interpret the user’s commands.<br />

Enter.User.Commands:<br />

DO ‘Get and process user input until Q, or QUIT input.<br />

IEEEout$ = “”<br />

‘Clear IEEEout$ string<br />

LINE INPUT IEEEout$<br />

‘Get the user input<br />

IEEEout$ = UCASE$(IEEEout$)<br />

‘Convert input to upper case<br />

SELECT CASE IEEEout$<br />

CASE “Q”, “QUIT”<br />

‘Exit on Q<br />

RETURN<br />

CASE “IBCLR”<br />

‘Allow a device clear<br />

CALL IBCLR(device.number%)<br />

CASE “IBRSP”<br />

‘Allow a serial poll<br />

CALL IBRSP(device.number%, poll%)<br />

PRINT poll%<br />

99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!