56
B.2 Example Program for IEEE 488 Communication (QuickBASIC)
‘************************ Program Header ************************************
‘NEWPORT CORPORATION
‘1830-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 1830-C controller via the IEEE-488 port. This program was specifically
‘written for the equipment below.
‘
‘This program was written on an IBM AT compatible using QuickBASIC 4.5
‘ and software routines supplied 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 on the above GPIB board follow the
‘ manufacturers instructions for installation of hardware and software.
‘ Be sure to read the section on setting up the QuickBASIC environment.
‘ Rename one of the devices “DEV4” when running the IBCONF program
‘ included with the board. Remember the device number you renamed
‘ and set the DIP switches on the back of the 1830-C to reflect the
‘ address you have selected.
‘
‘Written By: Rakesh Pandit
‘ Date: June 30, 1994
‘************************* End of Header ************************************
‘Beginning of program
‘$INCLUDE: ‘C:\AT-GPIB\QBASIC\QBDECL.BAS’ ‘Use your own path here.
‘Beginning of program
IEEEout$ = “DEV4” ‘IEEE-488 1830-C address must be
‘named DEV4 in the GPIB.COM file.
CALL IBFIND(IEEEout$, device.number%) ‘Setup the device.number% variable
‘used in GPIB-PC routine calls.
‘(National Instruments command)
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: