2 - Introduction to Programming
12
FUNCTION gets$
‘ Get a new line feed terminated string from device #1
C$ = “”
‘ Set C$ to null
WHILE c$ <> CHR$ (10)
‘ Set loop to stop at Line Feed
C$ = INPUT$ (1, #1)
‘ Read 1 bit into file #1
Resp$ = resp$ + c$
‘ Concantenate bit with previous bits
WEND
‘ End of WHILE loop
gets$ = resp$
‘ Assign response to gets$
END FUNCTION
RS-232 Troubleshooting
If you are having trouble communicating over the RS-232 interface, check the following:
♦
The computer and the dc source must be configured for the same baud rate, parity, number of
data bits, and flow control options. Note that the dc source is configured for 1 start bit and 1 stop
bit (these values are fixed).
♦
The correct interface cables or adaptors must be used, as described under RS-232 Connector.
Note that even if the cable has the proper connectors for your system, the internal wiring may be
incorrect.
♦
The interface cable must be connected to the correct serial port on your computer (COM1, COM2,
etc.).
Introduction to SCPI
SCPI (Standard Commands for Programmable Instruments) is a programming language for controlling
instrument functions over the GPIB. SCPI is layered on top of the hardware-portion of IEEE 488.2. The
same SCPI commands and parameters control the same functions in different classes of instruments. For
example, you would use the same DISPlay command to control the dc source display and the display of a
SCPI-compatible multimeter.
Conventions Used in This Guide
Angle brackets
<
>
Items within angle brackets are parameter abbreviations. For example,
<NR1> indicates a specific form of numerical data.
Vertical bar
|
Vertical bars separate alternative parameters. For example, NORM | TEXT
indicates that either "TEXT" or "NORM" can be used as a parameter.
Square Brackets
[
]
Items within square brackets are optional. The representation [SOURce:].
VOLTage means that SOURce: may be omitted.
Braces
{
}
Braces indicate parameters that may be repeated zero or more times. It is
used especially for showing arrays. The notation <A>{<,B>} shows that
parameter "A" must be entered, while parameter "B" may be omitted or
may be entered one or more times.
Boldface font
Boldface font is used to emphasize syntax in command definitions.
TRIGger:COUNt:CURRent <NRf> shows command definition.
Computer
font
Computer font is used to show program lines in text.
TRIGger:COUNt:CURRent 10
shows a program line.