C Control The I Unit-M Advanced 5 Vdc Inputs / outputs 16 x digital I/Os / 8 x analogue or digital I/Os Program memory 2 198805 Datenbogen

Produktcode
198805
Seite von 42
FUNCTIONS WITH PARAMETER RETURN 
A function also can return a float value if the return value is assigned to a help variable (in this example 
MyFunction) that is named equal to the function itself (here MyFunction) The help variable must dot be 
declared seperately. 
 
  
 
 
 
 
 
 
 
 
Review the example  
4_FUNCTION_1 and 2 for details. 
FUNCTION MyFunction(FVAL1 as FLOAT,FVAL2 as FLOAT) 
. . . . . . .  
MyFunction=FVAL1*FVAL2 
. . . . . . .  
END FUNCTION  
 
 
'------------ FUNCTION AUFRUF MIT RÜCKGABE ------------------------ 
FLOATVAR=MyFunction(10.9, 33.0) 
MATH OPERATIONS 
The overview shows the operations that are integrated to the operating system, and therefore executed with 
maximum speed. Other operations are available as extension, but are executed as BASIC Code. The 
functions are provided at the FLOTMATH.BLIB and described her in this document it the capter FLOATING 
POINTMATH BASIC++ LIBRARY  
 
Overview: 
 
MULTIPLY 
DIVIDE 
ADD  
SUBTRACT  
SQRT 
SIN 
COS   
ABS 
<, >, =, <=, >= 
 
 
 
 
 
 
 
 
 
 
 
 
 
Please review the example program 5_STANDARD_FLOAT_MATH.BAS  
 
 
 
 
 
 
 
 
 
 
 
MULTIPLY, DIVIDE, ADD, SUBTRACT 
 
For a multiply demo a conversion of a analog value (given by an ADC) to the true physical value is well 
suited. The result is shown at the LCD, limited to 4 digits after decimal point. The secons sample is a 
compare that show how  much more lines a program has, doing the equivalent conversion with integer 
calculations. 
 
 
36