Omega Vehicle Security 1400 User Manual

Page of 273
ChartScan Program Examples                                                                                                                                       
        Appendix D
D-8
ChartScan User’s Manual
Using the IEEE 488 SRQ with Alarms using  ALAR2SRQ.BAS
The following program, ALAR2SRQ.BAS, in the EXAMPLES directory will set up the alarm system of the
ChartScan  and then use the IEEE 488 Service Request signal to asynchronously service the event.
Although not necessary, it is good practice to reset the ChartScan at the beginning of your application by
sending it the “*R” command  and then waiting a few seconds.
CLS : PRINT “The ChartScan is resetting..”
PRINT #1, “OUTPUT 07;*RX”
SLEEP 4
To be certain that the reset was successful and the device is ready, serial poll the device until the proper
status is returned.
WHILE (S% AND 4) = 0
‘Wait for Ready
PRINT #1, “SPOLL 07"
INPUT #2, S%
WEND
The Personal488 IEEE 488 driver and interface card 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 Personal488 interface, program control is automatically vectored to the subroutine named in the ON
PEN GOSUB
 command.  To activate this feature in the Personal488 driver, the command ARM SRQ must
be sent to the driver.
ON PEN GOSUB AlarmHandler
PEN ON
PRINT #1, “ARM SRQ”
The M1 command instructs the unit to assert the SRQ signal when it is in an alarm state.
PRINT #1, “OUTPUT 07;M1X”
The C command is used twice to configure multiple channels as part of the scan group and to assign them a
type.  Additionally, the alarm parameters for channels one and two are used to activate the alarms for those
channels.  Although 16 channels are included in the scan group, only 2 are armed for alarming.
After the C command is issued, the ChartScan is now completely armed for alarming.  In our example,
levels above 25 or below 1 for channels 1 or 2 will cause a system alarm.  Since the M1 command has
already been issued, this will also result in an IEEE 488 SRQ assertion.
If the intent of the application was to use alarm levels to trigger an acquisition, only the following 2 lines
would be required to arm the alarms to satisfy the trigger and/or stop events.
PRINT #1, “OUTPUT 07;C1-16,3X”
PRINT #1, “OUTPUT 07;C1-2,3,1,25,0X”
In addition to causing an internal system alarm state, the alarm conditions can also be attached to any one of
the 16 digital output lines.  The A command is used to assign the temperature input channel to the digital
alarm bit.
PRINT #1, “OUTPUT 07;A1,1X”
‘Assign channel 1 to alarm 1
PRINT #1, “OUTPUT 07;A2,2X”
‘Assign channel 2 to alarm 2
PRINT #1, “OUTPUT 07;A3,3X”
‘Assign channel 3 to alarm 3
The example now processes a loop waiting for a key press 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.
PRINT “The program is continuously detecting Alarms ..”
PRINT “Hit a key to Quit..”
WHILE INKEY$ = “”: WEND
END
In the alarm service routine, the unit is first SPOLL’d to clear the SRQ signal.  Using the string returned by
the O? query, which gets the status of the digital output lines, the channel number that is in the alarm state
can be identified.