Read alarms – Sensoray 417 User Manual
Page 22

21
Sensoray Model 417
Chapter
4
Programming
Read Alarms
This command (1) returns alarm status from a group of eight channels, and (2) clears the alarm sta-
tus of all channels within the 8-channel group, and (3) resets the status register ALARM bit. A
Group Code is used to designate which 8-channel block is being addressed. The first response byte
reflects the status of high limit violations and the second byte reflects the status of low limit viola-
tions. Any status bit that is set to logic 1 indicates a violated limit.
COMMAND: (108 + GroupCode)
RESPONSE:
(HighLimitFlags), (LowLimitFlags)
VB Code Example:
‘**********************************************************************
‘ Fetch alarm flags from one 8-channel group.
‘**********************************************************************
Sub ReadAlarms(BasePort%, GroupCode%, HiFlags%, LoFlags%)
Call SendByte(108 + GroupCode)
‘request group alarm flags
HiFlags = ReadByte(BasePort)
‘read high flags
LoFlags = ReadByte(BasePort)
‘read low flags
End Sub
‘**********************************************************************
‘ Check alarm status. If alarm(s) are sounding, test channels 8-15 and
‘ return the number of channels sounding in AlarmCount and a list
‘ of alarming channels in AlarmList(1 to 8). Assume all other channels
‘ have disabled alarms.
‘**********************************************************************
Sub GetAlarmList(BasePort%, AlarmCount%, AlarmList%())
Dim HiFlags%, LoFlags%, Chan%
AlarmCount = 0
If (INP(BasePort + 1) And ALARM) Then
Call ReadAlarms(BasePort, 1, HiFlags, LoFlags)
For Chan = 8 to 15
If (HiFlags Or LoFlags) And (2 ^ (Chan And 7)) Then
AlarmCount = AlarmCount + 1
AlarmList(AlarmCount) = Chan
End If
Next Chan
End If
End Sub
Table 9: Channel mapping for Read Alarms command response bytes
Group
Code
Either Response Byte
D7
D6
D5
D4
D3
D2
D1
D0
0
A
d
d
re
ss
e
d
C
h
an
n
e
l
7
6
5
4
3
2
1
0
1
15
14
13
12
11
10
9
8
2
23
22
21
20
19
18
17
16
3
31
30
29
28
27
26
25
24