sosIntegerGetDint (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.00.00


sosIntegerGetDint will retrieve the current value of an integer object as a DINT.

 

Input:

key : STRING

The key for the object to retrieve.

 

Output:

value : DINT

The value of the object.

 

Returns: INT

0

- The value has been retrieved.

-1

- Generic error.

-10

- Object not found.

-11

- Object has the wrong type.

-12

- Content has invalid size.

 

 

Declaration:

FUNCTION sosIntegerGetDint : INT;
VAR_INPUT
  key   : STRING;
  value : ACCESS DINT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc   : INT;
  baud : DINT;
END_VAR;
BEGIN
  ...
  // Create integer object
  rc := sosIntegerCreate(key := "config.baud", value:=115200, desc := "Baud rate for the connection");
  DebugFmt(message:="sosIntegerCreate=\1", v1:=rc);
  // Update integer object
  rc:= sosIntegerSet(key:="config.baud", value:=6000);
  DebugFmt(message:="sosIntegerSet=\1", v1:=rc);
 
  // Read integer object
  rc:= sosIntegerGetDint(key:="config.baud", value:=baud);
  DebugFmt(message:="sosIntegerGetDint=\1 => \4", v1:=rc, v4:=baud);
  ...
END;
 
END_PROGRAM;