void GetVarValue(string VarName, string value);
double GetVarValue(string VarName);
Reads the value or string of the given internal variable. Instead of this function, you can use a = var.
Parameters
VarName - The name of the variable from which you want to get the value (refers to the variable declared in the Data section).
value - Buffer to store the read string.
This refers to the buffer that will store the string type of the variable you want to read. You can use a char array.
Return Value
The return value is a number if the value you want to get is not a string and is of type double.
Example 1
@GetVarValue("var1", buf);
Description: Reads the value of var1 and stores it in the buf array.
Example 2
value = @GetVarValue("var2");
Description: Reads the value of var2 and assigns it to value.
Example 3
for(i=0; i<10; i=i+1){
@sprintf(buf, "var%02d", i)
// The above function stores var00 in buf when i=0, var01 in buf when i=1, and so on, as the for loop executes.
value = @GetVarValue(buf);
// Stores the value stored in buf (var00's value when i=0, var01's value when i=1, etc.) in value sequentially.
}
Note