beautypg.com

Measurement Computing TempScan/1100 User Manual

Page 292

background image

C-22 Program Examples in Quick Basic

879696

TempScan / MultiScan, Appendix C

The following program is

ALAR2SRQ.BAS

in the

\EXAMPLES\

subdirectory. It will set up the alarm

system of the MultiScan/1200, and then it will use the IEEE 488 Service Request signal to asynchronously
service the event.

Lines 1-3: Although not necessary, it is good practice to reset the MultiScan/1200 at the start of your

application by sending the Reset Power-On (

*R

) command. Wait a few seconds.

Lines 4-8: To be certain that the reset was successful and the device is ready, Serial Poll the device

until the proper status is returned.

Lines 9-10: The PC/IEEE 488 controller interface and driver software provides a means for

QuickBASIC to asynchronously service the IEEE 488

SRQ

interrupt through its

ON PEN GOSUB

command. When an

SRQ

is detected by the controller, program control is automatically vectored to the

subroutine named in the

ON PEN GOSUB

command. To activate this feature in the

IEEE 488

driver, the

command

ARM SRQ

must be sent to the driver.

Line 11: The Set SRQ Mask (

M

) command

M1

instructs the MultiScan/1200 unit to assert the

SRQ

signal when it is in an alarm state.

Lines 12-13: The first thing necessary to start scanning is to setup the measuring mode. In this case,

the MultiScan/1200 will be setup for line-cycle integration / high-speed multi-channel mode.

Lines 14-15: The Configure Channels (

C

) command will be used once to configure a range of

channels from 1 to 24 as Type T thermocouples, and used again to configure Channels 1 and 2 such
that levels above 25 or below 1 will cause a system alarm. Once the

C

command is issued, the

MultiScan/1200 will be completely armed for alarming. Since the

M1

command has already been

issued, this will also result in an IEEE 488

SRQ

assertion.

Line 16-17: In addition to causing an internal system alarm state, the alarm conditions can also be

attached to any one of the 32 digital output lines. The Assign Digital Alarm Output (

A

) command will

be used to assign input Channel 1 to digital alarm Output 1, and Channel 2 to Output 2, individually.

Lines 18-19: Program for one Pre-Trigger scan via the Set Counts (

Y

) command. Then program the

Trigger (trigger start event) and Stop (trigger stop event) via the Set Trigger Configuration (

T

)

command to arm the acquisition.

Lines 20-37: This example now processes a loop that is waiting for a key press in order to exit. If an

SRQ

is detected by the IEEE 488 driver, program control will be automatically vectored to the

AlarmHandler

subroutine, then returned to the wait loop again. In the alarm service routine, the

MultiScan/1200 unit is first Serial Polled (

SPOLL

ed) to clear the

SRQ

signal. The Set Digital Outputs

(

O

) command

O?

will be used to query the status of the digital output lines. In turn, the channel

number that is in the alarm state can be identified.

This manual is related to the following products: