Example
Program
IEEE-488
Communication
'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 2832-C Dual-Channel Power 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
r++*+**+****+****++**t*tt*
End
of
Header
ffffffffffffffff*fftttt*tttt+***++t*
'Beginning of program
'$INCLUDE: 'E:\b45\QBDECL.BAS1 'Use your own path here.
'Beginning of program
IEEEoutS
=
"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
GOSUB Enter.User.Commands
END 'End of program
'Draw header on the screen
'Process user input
'Main.Screen: Draw the main screen.
Main.Screen:
CLS
LOCATE 1, 22: PRINT "N E
W
P
0
R T C
0
R P
0
R A T I0 N"
LOCATE 2, 19: PRINT "2832-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
CASE
CASE
UQ,,, "QUIT"
'Exit on Q
RETURN
"
I BCLR" 'Allow a device clear
CALL IBCLR(device.number%)
"
IBRSP" 'Allow a serial poll
CALL IBRSP(device.number%, poll%)
PRINT poll%
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com