beautypg.com

Set limits – Sensoray 417 User Manual

Page 20

background image

19

Sensoray Model 417

Chapter

4

Programming

Set Limits

This command declares signed, 16-bit integer, upper and lower alarm threshold limits for a chan-
nel. An alarm will “sound” if the scaled sensor data strays below the lower limit or above the upper
limit. The alarm “sounds” by setting the ALARM bit in the status register.

All limits assume default values when the coprocessor is reset. Low limits reset to -32768, and
high limits to 32767. These default values effectively disable the alarm function. To disable the
lower limit, specify a lower limit of -32768. Similarly, declare an upper limit of 32767 to disable
the upper limit.

When a channel limit is exceeded, both channel limits are reset to their default values. This pre-
vents the alarm from sounding again after the host has acknowledged the violation. The host must
reprogram the violated limit to re-arm it.

COMMAND: (64 + Chan),

(HiLimit MSB), (HiLimit LSB),
(LoLimit MSB), (LoLimit LSB)

RESPONSE:

NONE

VB Code Example:

‘**********************************************************************

‘ Generic procedure to set alarm limits for one channel.

‘**********************************************************************

Sub SetLimits(Channel%, LoLimit%, HiLimit%)

Const SET_LIMITS = 64

‘SET LIMITS command opcode

‘ Set channel alarm limit values on 417 board

Call SendByte(BasePort, SET_LIMITS + Channel)

Call SendWord(BasePort, HiLimit)

Call SendWord(BasePort, LoLimit)

End Sub

‘**********************************************************************

‘ Channel 7 is configured for a K thermocouple, 0.1C/bit. Program limits

‘ so that alarm will “sound” if temperature strays outside 400C-to-450C.

‘**********************************************************************

Dim Scalar

As Single

‘Data scalar appropriate for sensor type

Dim HiLim

As Integer

‘High alarm limit threshold

Dim LoLim

As Integer

‘Low alarm limit threshold

Scalar = 0.1

‘K thermocouple data scalar (from table)

HiLim = 450.0 / Scalar

‘compute high alarm limit value

LoLim = 400.0 / Scalar

‘compute low alarm limit value

Call SetLimits(BasePort, LoLim, HiLim)‘Set channel 7 alarm limits