owAlarmSearch (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Firmware version:

2.80 / 1.00.00


This function will search for the first 1-Wire device responding to a conditional search.

See owSearchX to perform a normal search.

 

To make a device respond to owAlarmSearch, please consult the data sheet for the specific device.

 

After the device has been discovered, it can be accessed with owAlarmAccess.

 

Input:

first        : INT [0..255] (default 0)

Skip devices with lower family codes.

 

last        : INT [0..255] (default 255)

Do not search for devices with higher family codes than this.

 

Returns: INT

1


Device found.

0


No device found.

-1


General error or not supported on target.

 

Declaration:

FUNCTION owAlarmSearch : INT;
VAR_INPUT
   first INT := 16#00;
   last  INT := 16#FF;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
BEGIN
   ...
   // Search for a DS2408 or a temperature sensor that is alerting.
   IF owAlarmSearch(first := 16#28last := 16#29) < 1 THEN
      DebugMsg(message:="No alarm!");
   ELSE
      // Get ID of device
      DebugMsg(message:="Alarm on device: " + owAlarmGetID());
      // Get Family of device
      DebugMsg(message:="Device family: " + owAlarmGetFamily());
      ...
   END_IF;
END;
 
END_PROGRAM;