owAccess (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 a 1-Wire device and prepare it for device-specific commands.

The device must first have been discovered with owSearchX.

 

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

 

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

 

Input:

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

Family code of the device to access/select.
0 = Any family code. The device count will ignore family code and will represent the raw order of found devices with the lowest family first.

 

device        : INT [1..50] (default 1)

Device number within the applied family.
1 = This will give the first device within family if present. When <family> is 0, the device count continues across family codes.

 

Returns: INT

0


Successful

-1


General error or not supported on target.

-2


Device not present.

-3


Illegal device number.

-4


Illegal family code.

 

Declaration:

FUNCTION owAccess : INT;
VAR_INPUT
  family   : INT := 16#00;
  device   : INT := 1;
END_VAR;

 

 


Example:

 

Please see the "Examples - Generic OneWire Example"