111
D.2
Example Program IEEE-488 Communication
‘*********************** Program Header *******************************
‘NEWPORT CORPORATION
‘2835-C to IEEE-488 Communication Program - an example program
‘
‘The following program is designed to be an example of how to write a simple
‘program that will write commands and read query responses to and from
‘the 2835-C Multi-Function Optical Meter via the IEEE-488 port.
‘
‘This program was written on an IBM AT compatible using QuickBASIC 4.5
‘ and software routines included with the GPIB board.
‘The GPIB board used was:
National Instruments GPIB-PC2A board
‘
Newport Corporation pn LA-PC-488-2A-5
‘The interface cable was:
Newport Corporation pn LA-CABLE-2M488
‘
‘NOTE: Before running this program follow National Instrument’s instructions
‘
for hardware and software installation. This program uses the GPIB
‘
configuration device named DEV5 which uses GPIB address 5 by default.
‘
All routines that begin with the letters “IB” are defined in the
‘
National Instruments library.
‘
‘Written By: Darwin D. Smith
‘ Date: April 28, 1993
‘************************* End of Header ************************************
‘Beginning of program
‘$INCLUDE: ‘E:\b45\QBDECL.BAS’
‘Use your own path here.
‘Beginning of program
IEEEout$ = “DEV5”
‘Use this name or assign a new one
CALL IBFIND(IEEEout$, device.number%) ‘Setup the device.number% variable
‘used in GPIB-PC routine calls.
IF device.number% < 0
THEN
PRINT “Unable to find “; IEEEout$; “ device.”
STOP
END IF
GOSUB Main.Screen ‘Draw header on the screen
GOSUB Enter.User.Commands ‘Process user input
END ‘End of program
‘Main.Screen: Draw the main screen.
Main.Screen:
CLS
LOCATE 1, 22: PRINT “N E W P O R T C O R P O R A T I O N”
LOCATE 2, 19: PRINT “2835-C to IEEE-488 Communication Program”
LOCATE 3, 19: PRINT “ Q or q to Quit”
RETURN
‘Enter.User.Commands: Get and interpret the user’s commands.
Enter.User.Commands:
DO ‘Get and process user input until Q, or QUIT input.
IEEEout$ = “” ‘Clear IEEEout$ string
LINE INPUT IEEEout$ ‘Get the user input
IEEEout$ = UCASE$(IEEEout$) ‘Convert input to upper case
SELECT CASE IEEEout$
CASE “Q”, “QUIT” ‘Exit on Q
RETURN
CASE “IBCLR” ‘Allow a device clear
CALL IBCLR(device.number%)
CASE “IBRSP” ‘Allow a serial poll
CALL IBRSP(device.number%, poll%)
PRINT poll%
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com