More about device and board functions – National Instruments GPIB-PC User Manual

Page 57

Advertising
background image

GPIB-PC Functions — Introduction

Section Three

GPIB-PC User Manual

3-14

©National Instruments Corp.

More About Device and Board Functions

Before proceeding to the next group of functions, you will find it helpful
to compare how a high-level device function can be replaced by several
low-level board functions. Conducting a serial poll is a good example.
In the discussion of the

IBRSP

function of Group II, this BASIC

example of the device function was used:

CALL IBRSP (PLTR%,STATUS%)

This is equivalent to the following sequence using the board functions
just described:

CMD$ = "?" + CHR$(&H18) + "G!"
CALL IBCMD (GPIB0%,CMD$)
STATUS$ = SPACE$(1)
CALL IBRD (GPIB0%,STATUS$)
CMD$ = "_?" + CHR$(&H19)
CALL IBCMD (GPIB0%,CMD$)

The first

IBCMD

function is used to send the string of ASCII commands

assigned in the first program line. These are Unlisten (

?

), Serial Poll

Enable (

CHR$(&H18)

), talk address of the plotter (

G

), and listen

address of the board (

!

). Now that the plotter is enabled to send its

status byte and the board is addressed to receive it, the

IBRD

function is

called to read the byte and store it in the variable

STATUS

. The final

IBCMD

function completes the poll by sending the command string

consisting of three messages: Untalk (

_

), Unlisten (

?

), and Serial Poll

Disable (

CHR$(&H19)

).

You can see that a high-level device function is easier to use. However,
when an application requires a more complex serial poll routine than the
one just described, such as a serial poll routine which polls several
devices in succession and provides other servicing operations at the
same time, low-level board functions can be used to create such a
routine.

Advertising