owiButtonSetLED (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All devices with 1-Wire except CX1

Firmware version:

1.00 / 1.00.00


The iButton reader is supplied with an LED that can easily be used to inform the user if the iButton placed in the reader is valid or not. Example: fast blinking = access, slow blinking = no access. The LED is controlled with the owiButtonEnableLED and owiButtonSetLed functions.

 

The owiButtonSetLED controls the state of the LED placed inside the iButton reader. Before the state can be controlled, owiButtonEnableLED must be set to "on".

 

Please notice:

When the RTCU device has been connected to the RTCU IDE, the user may experience a delay before the LED is ready for use. This is due to a timeout when disconnecting from the RTCU- IDE.

A delay may also be experienced when the owiButtonEnableLED is set to "on" and the user connects the RTCU device to the RTCU IDE.

 

Input:                

state : BOOL

The new state of the LED in the iButton reader.                

 

Returns:

None.

 

Declaration:

FUNCTION owiButtonSetLed;
VAR_INPUT
  state : BOOL;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  iButtonID : STRING;
END_VAR;
 
PROGRAM test;
 
  // Enable use of I-Button Led
  owiButtonEnableLED( enable := ON );
BEGIN
  ...
  // Get I-Button ID
  iButtonID := owiButtonGetID();
  // Was a I-Button present?
  IF strLen(str:=iButtonID) = 12 THEN
    // Valid I-Button ID is 12 characters long (000008F5E179)
    // Turn I-Button LED on to show that I-Button ID has been read
    owiButtonSetLED( state := ON );
     ...
    // Turn I-Button LED off
    owiButtonSetLED( state := OFF );
  END_IF;
  ...
END;
 
END_PROGRAM;