sosFloatGet will retrieve the current value of a FLOAT object.
Please note that when using this function, math.inc must be explicitly included by the application.
Input:
key : STRING
The key for the object to retrieve.
Output:
value : FLOAT
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 sosFloatGet : INT;
VAR_INPUT
key : STRING;
value : ACCESS FLOAT;
END_VAR;
Example:
INCLUDE rtcu.inc
INCLUDE math.inc
PROGRAM test;
VAR
rc : INT;
temp : FLOAT;
END_VAR;
BEGIN
...
rc := sosFloatCreate(key := "config.max_temperature", value:=24.5, desc := "Largest temperature measured");
DebugFmt(message:="sosFloatCreate=\1", v1:=rc);
rc:= sosFloatSet(key:="config.max_temperature", value:=26.7);
DebugFmt(message:="sosFloatSet=\1", v1:=rc);
rc:= sosFloatGet(key:="config.max_temperature", value:=temp);
DebugFmt(message:="sosFloatGet=\1 => " + floatToStr(v:=temp), v1:=rc);
...
END;
END_PROGRAM;
|