ezeio2:scriptref:getregisterstatus

Get status of a register

Description

GetRegisterStatus( deviceno, registerno, parameter )

Fetches the status of a register

Parameters

deviceno Device number (1-40)
registerno Which register to fetch
parameter The parameter to request, one of REGSTAT_VALUE, REGSTAT_AGE, REGSTAT_INUSE, REGSTAT_TYPE

Return value

Depends on the parameter

REGSTAT_VALUE Return value is the value of the register (same as GetRegister)
REGSTAT_AGE Return value is the number of seconds since the register was updated (max 4095)
REGSTAT_INUSE Return value is 1 if the register is in use/allocated, or 0 if not
REGSTAT_TYPE Return value is one of NULL, INT, UINT, FLOAT

Example usage

    new x;
 
    AllocateRegisters(3, 8);        // Allocate eight registers for device 3    
    SetRegister(3, 1, 1234, INT);   // Set register 1 on device 3 to the value 1234
 
    x = GetRegisterStatus(3, 1, REGSTAT_TYPE);   // x = INT
    x = GetRegisterStatus(3, 1, REGSTAT_AGE);    // x = 0 (since we just updated it)
 

NOTE: First appeared in firmware 24052201

  • ezeio2/scriptref/getregisterstatus.txt
  • Last modified: 2024-05-22 21:44
  • by andreh