beautypg.com

Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 134

background image

II. SOFTWARE GUIDES - 8. Driver488/DRV

8N. Operating Modes

Personal488 User’s Manual, Rev. 3.0

II-119

There are two ways to detect our being addressed to Listen: through the

STATUS

command, or by

detecting an interrupt with the

ARM

command.

The

STATUS

command can be used to watch for commands from the Active Controller. The Operating

Mode, which is a

“P”

while Driver488/DRV is a Peripheral, changes to a

“C”

if the Active Controller

passes control to Driver488/DRV. The Addressed State goes from

Idle

“I”

to

Listen

“L”

or

Talk

“T”

if Driver488/DRV is addressed to Listen or to Talk, and goes back to

IDLE

“I”

when the Active

Controller issues

Unlisten

(

UNL

),

Untalk

(

UNT

), or specifies another

Talker Address Group

(

TAG

). The

TRIGGER

“T1”

and

CLEAR

“C1”

indicators are set when Driver488/DRV is triggered or

cleared, and reset when

STATUS

is read. The Address Change indicator is set to

CHANGE

“G1”

when

the Addressed State changes. These indicators allow the program to sense the commands issued to
Driver488/DRV by the Active Controller.

The various

STATUS

indicators and their descriptions are provided in the following table:

STATUS Indicator

Description

“P” (Peripheral)

Driver488/DRV is in the Peripheral (

*CA

) operating mode.

“C” (Controller)

Driver488/DRV is the Active Controller (

CA

).

“T1” (Trigger)

Driver488/DRV, as a Peripheral, has received a

TRIGGER

bus command.

“C1” (Clear)

Driver488/DRV, as a Peripheral, has received a

CLEAR

bus command.

“T” (Talk)

Driver488/DRV is in the

Talk

state and can

OUTPUT

to the bus.

“L” (Listen)

Driver488/DRV is in the

Listen

state and can

ENTER

from the bus.

“I” (Idle)

Driver488/DRV is in neither the

Talk

nor

Listen

state.

“G1” (Change)

An Address Change has occurred, that is, a change between Peripheral

and Controller, or among

Talk

,

Listen

, and

Idle

has occurred.

This is, perhaps, the most useful interrupt in the Peripheral mode.

The following BASIC program fragment illustrates the use of the Address Change and Addressed State
indicators to communicate with the Active Controller.

First, check

STATUS

until it indicates there has been an Address Change:

200 PRINT#1,"STATUS"
210 INPUT#2 ST$
220 ‘Has there been no Address Change?
230 IF MID$(ST$,7,1)="0" THEN 200
240 ‘Are we still in the idle state?
250 STATE$=MID$(ST$,9,1)
260 IF STATE$="I" THEN 200
270 ‘Are we addressed to listen?
280 IF STATE$="L" THEN 400
290 ‘Are we addressed to talk?
300 IF STATE$="T" THEN 500
310 PRINT “BAD ADDRESSED STATE VALUE: ”;ST$: STOP

If addressed to

Listen

, then

ENTER

a line from the controller and

PRINT

it out:

400 ‘Listen state
410 PRINT#1,"ENTER"
420 LINE INPUT#2,A$
430 PRINT A$
440 GOTO 200

If addressed to

Talk

, then

INPUT

a line from the keyboard and

OUTPUT

it to the controller:

500 ‘Talk state
510 LINE INPUT A$
520 PRINT#1,"OUTPUT;";A$
530 GOTO 200

It is also possible to detect these conditions with the

ARM

command and handle them in an Interrupt

Service Routine (ISR). The

Peripheral

,

Controller

,

Talk

,

Listen

, and

Idle

conditions cause

interrupts only when the Address Change indicator

“G1”

in the

STATUS

response is set. The

Change

,

Trigger

, and

Clear

indicators are all reset by the

STATUS

command. Thus, the

STATUS

command