owAlarmAccess (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All devices with 1-Wire

Firmware version:

2.80 / 1.00.00


This function will select the alerted 1-Wire device and prepare it for device specific commands.

The device must first have been discovered with owAlarmSearch.

 

This will also acquire the 1-Wire lock which allows no other threads access to the 1-Wire net until it has been released by calling owAlarmRelease. Failing to do so will result in a fault 148 (see Fault codes for further details).

 

The lock can be refreshed with another call to owAlarmAccess but owAlarmRelease must be called the same number of times before all locks are released.

 

Input:

None.

 

Returns: INT

0


Successful.

-1


General error or not supported on target.

-2


Device not present.

 

Declaration:

FUNCTION owAlarmAccess : INT;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
BEGIN
  ...
  // Query for a device that is alerting.
  IF owAlarmSearch() < 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());
    IF owAlarmAccess() = 0 THEN
        // Communicate with device
        ...
        // Release device
        owAlarmRelease();
    END_IF;
  END_IF;
END;
 
END_PROGRAM;