Lakeshore Learning Materials 622 User Manual
Page 43

Lake Shore Model 620/622/623/647 Magnet Power Supply User’s Manual
Remote Operation
4-5
4.1.5
Notes On Using the IEEE Interface
• The term "free field" indicates a floating decimal point that may be placed any appropriate place in the
string of digits.
• [term] indicates where the user places terminating characters or where they appear on a returning
character string from the MPS.
• To chain commands together, insert a semi-colon, comma, or blank space between them. Some
programming languages allow only blank spaces to chain. Multiple queries cannot be chained. The MPS
responds to the last query entered when addressed as a talker.
• Queries generally use the same syntax as an associated setting command followed by a question mark.
They most often return the same information that is sent. Some queries have no command form.
• Leading zeros and zeros following a decimal point are unneeded in a command string, but they are sent in
response to a query. A leading “+” is not required, but a leading “–” is required.
• As characters are received over the interface, they store in a buffer with a length of 95 characters. After
receiving the terminators, any new parameters are stored. The Mainframe requires about 100 msec to
store new parameters before receiving any new commands.
• The Mainframe implements new parameters and updates measurement data once per 500 msec operation
cycle (noted by the blinking asterisk to the left of the mode status). Sending new parameters or requesting
data at a rate faster than 2 Hz is not recommended.
Table 4-1 Sample BASIC IEEE-488 Interface Program
'
IEEEEXAM.BAS
EXAMPLE PROGRAM FOR IEEE-488 INTERFACE
'
'
This program works with QuickBasic 4.0/4.5 on an IBM PC or compatible.
'
'
The example requires a properly configured National Instruments GPIB-PC2 card. The REM
'
$INCLUDE statement is necessary along with a correct path to the file QBDECL.BAS.
'
CONFIG.SYS must call GPIB.COM created by IBCONF.EXE prior to running Basic. There must
'
be QBIB.QBL library in the QuickBasic Directory and QuickBasic must start with a link
'
to it. All instrument settings are assumed to be defaults: Address 12, Terminators
'
'
'
To use, type an instrument command or query at the prompt. The command transmits to the
'
instrument and the MPS receives and displays the response. If no query is sent, the
'
instrument responds to the last query received. Type "EXIT" to exit the program. NOTE: The
'
INPUT instruction accepts no commas as part of an input string. If a comma appears in an
'
instrument command, replace it with a space.
'
REM $INCLUDE: 'c:\gpib-pc\qbasic\qbdecl.bas
'Link to IEEE calls
CLS
'Clear screen
PRINT "IEEE-488 COMMUNICATION PROGRAM"
PRINT
CALL IBFIND("dev12", DEV12%)
'Open communication at address 12
TERM$ = CHR$(13) + CHR$(10)
'Terminators are
LOOP2:
IN$ = SPACE$(2000)
'Clear for return string
INPUT "ENTER COMMAND (or EXIT):"; CMD$
'Get command from keyboard
CMD$ = UCASE$(CMD$)
'Change input to upper case
IF CMD$ = "EXIT" THEN END
'Get out on Exit
CMD$ = CMD$ + TERM$
CALL IBWRT(DEV12%, CMD$)
'Send command to instrument
CALL IBRD(DEV12%, IN$)
'Get data back each time
ENDTEST = INSTR(IN$, CHR$(13))
'Test for returned string
IF ENDTEST > 0 THEN
'String is present if
IN$ = MID$(IN$, 1, ENDTEST - 1)
'Strip off terminators
PRINT "RESPONSE:", IN$
'Print return string
ELSE
PRINT "NO RESPONSE"
'No string present if timeout
END IF
GOTO LOOP2
'Get next command