beautypg.com

Alarms, Setalarmlimits, 5 alarms – Sensoray 118 User Manual

Page 32: 1 setalarmlimits

background image

Sensoray Model 118 Smart A/D™ Instruction Manual

30

Commands: Alarms

6.5 Alarms

6.5.1 SetAlarmLimits

Specifies high and low alarm limits for a channel. An
alarm will sound if sensor data is more positive than the
high limit or more negative than the low limit. Limits are
specified as 16-bit signed integers.

The high limit may be disabled by setting it to 32767, and
the low limit may be disabled by setting it to -32768.

Limits must be converted from engineering units to the
required integer values by scaling as appropriate for the
channel’s sensor type. In the case of a K thermocouple
(0.1°C/bit) for example, divide the desired limit
(expressed in °C) by 0.1 to obtain the integer value.

As shown in Figure 14, all channel alarms are initially in
the Disabled state. To switch to the Armed state, the

SetAlarmLimits

command is invoked with the desired

limit values specified. To return to the Disabled state,
invoke

SetAlarmLimits

with both limits disabled.

If a limit violation is detected while the alarm is Armed,
the channel switches to the Sounding state. This causes
the Smart A/D™ status register

ALRM

flag to be asserted.

A channel remains in the Sounding state until the

GetAlarms

command is executed. When

GetAlarms

executes, the channel switches to the disabled state,
where it remains until the host again arms the alarm.

Figure 14: Alarm state diagram for an individual channel

When an alarm ‘sounds’, both violated limits are reset to
the default value. This prevents the alarm from sounding
again after the host has acknowledged the alarm. The
host must reprogram the violated limit if the Smart
A/D™ is to continue monitoring it.

Driver

// Set alarm limit values for the specified channel.

// Scalar converts limit values to Smart A/D integer units.

VOID SetAlarmLimits( USHORT BasePort, UCHAR Channel, DOUBLE LoLim, DOUBLE HiLim, DOUBLE Scalar )

{

SendByte( BasePort, Channel | CMD_SET_LIMITS ); // send chan & opcode

SendWord( BasePort, (SHORT)( HiLim / Scalar ) ); // send high limit

SendWord( BasePort, (SHORT)( LoLim / Scalar ) ); // send low limit

}

Example

// Channel 7 is measuring a K thermocouple (0.1 C/bit) that monitors a process

// temperature which must fall between 400 and 450 degrees C. Program alarm

// limits so that the Smart A/D alarm flag will be asserted if the temperature

// strays outside operating limits.

SetAlarmLimits( MyBasePort, 7, 400.0, 450.0, SCALAR_TC_K );

Command: (32 + Chan),(HiLimitMSB),(HiLimitLSB),(LoLimitMSB),(LoLimitLSB)

Response:

None

Disabled

Sounding

Armed

Reset

GetAlarms

Violation

D

is

a

rm

Ge

tA

larm

s

A

rm

Vi

ol

at

io

n

This manual is related to the following products: