sosFloatSet will update the value of an existing 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 update.
value : FLOAT default 0
The new value for the object.
Returns: INT
0
|
- The object is updated.
|
-1
|
- Generic error.
|
-2
|
- Invalid parameter.
|
-10
|
- Object not found.
|
-11
|
- Object has the wrong type.
|
Declaration:
FUNCTION sosFloatSet : INT;
VAR_INPUT
key : STRING;
value : FLOAT := 0.0;
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;
|