Keithley IE-488 Manual page 51

Table of Contents

Advertisement

200 IFFLG%<>O THEN PRINT "ERROR # ";HEX$(FLG%)
:END
'Again,
optional
check
for
errors.
Nowwewill
read dat .a from the DVM. The DVM outputs
a data
string
of ASCII
characters
. . NDCV+O.l234E+O
meaning
normal
DC volts,
+0.1234
exponent
10 -"O 'i.e.
1. This
is
typical
of many IEEE-488
instrument
responses.
To fetch
this
data
we use
the
ENTER
command. Conversely,
if
we wanted
to write
data
to the
instrument
we would
use the OUTPUT command.
The first
step
is to setup
a data
variable
to receive
this
data.
Since
we are
expecting
an ASCII
string,
we choose
a string
variable
with
enough elements
to contain
the expected
data.
210 DVMDT$ = SPACES(25)
'An empty
(spaces)
25 character
string.
220 CMD$ = "ENTER 12[$,0,181"
'Enter
data
from
device
12. The image
specifiers
tell
the IE-488
firmwarethatthe
data transfer
will
be to a
string
variable
($) and that
19 characters
are
to be
transferred
to elements
0 thru
18 of the string.
230 CALL IE488
(CMDS, DVMDT$, FLG%, BRD%)
'Note
that
although
we have used the mnemonic
CMD$ as a
name for
our
command string
variable
throughout
our
examples,
you are free
to choose
any other
string
name
e.g.
MYOWNNM$ for
command
data
as
long
as
it
is
correctly
referenced
in the CALL parameter
list.
240 IF FLG%<>O THEN PRINT "ENTRY ERROR" : END
'Checks
for
transfer
errors
- optional.
The data
is now in DVMDT$. The numeric
and range
information
can
be sorted
out using
BASIC's
string
functions
e.g.
MID$,
VAL
etc.
Alternatively,
in a fixed
format
response
application,
the image
specifier
can select
out
the
data
of
interest
in the
response
string.
This
exampleshows
how in 15 lines
of code,
many lines
of which
are
optional,
the
IE-488
board
can
be initialized
and
data
returned.
It
also
shows how the
firmware
interpreter
minimizes
user
programming
and keeps
communication
with
the
IEEE-488
buss
down to memorizing
a few "English
like"
commands,
a feature
that
is unique
to the MetraByte
IE-488
interface.
Another
helpful
hint
on using
the
IEEE488
bus with
different
instruments
is
to insure
that
each
instruction
has sufficient
time
to complete
its
requested
command before
issuing
another.
Page 45

Advertisement

Table of Contents
loading

Table of Contents