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
LCD.PRINT MyVar & "VOLT"
Note:
It is not possible to print a term of float variables like PRINT (MyVar1*MyVar2).
It alway has to be a float variable like this print example: PRINT(MyVar)
Examples:
o
ption float
define FV1 as float
define FV2 as float
LCD.INIT
'--------------------------------------------------------------------------- -------------------------
FV1=exp(1.23456789,4) '1.23456789E04
'---------------------------------------------------------------------------- ------------------------
FV2=12345.6789
'------------------------- EXAMPLE FOR OUTPUT -----------------------------------------
LCD.POS 1,1
LCD.PRINT FV1 & " VOLT "
LCD.POS 2,1
LCD.PRINT FV2 & " VOLT "
define FV2 as float
LCD.INIT
'--------------------------------------------------------------------------- -------------------------
FV1=exp(1.23456789,4) '1.23456789E04
'---------------------------------------------------------------------------- ------------------------
FV2=12345.6789
'------------------------- EXAMPLE FOR OUTPUT -----------------------------------------
LCD.POS 1,1
LCD.PRINT FV1 & " VOLT "
LCD.POS 2,1
LCD.PRINT FV2 & " VOLT "
Evaluate the sample program FP_INPUT_OUTPUT. Change the format parameters to get familiar with.
TYPE CONVERSION FLOAT<-> INTEGER WORD/BYTE
Depending on the application it may be usefull to convert data types. In all cases the user has to ensure that
the values of the variables match the type they should be converted to. A value 70000 e.g can not be
conveerted to a WORD or BYTE type variable.
the values of the variables match the type they should be converted to. A value 70000 e.g can not be
conveerted to a WORD or BYTE type variable.
FLOAT
Conversion of a term or variable from BYTE/WORD Type to FLOAT
MyFloat = FLOAT(MyWord)
MyFloat = MyFloat*FLOAT(MyWord)
MyFloat = MyFloat*FLOAT(MyWord*MyWord)
MyFloat = MyFloat*FLOAT(MyWord*MyByte)
MyFloat = MyFloat*FLOAT(MyWord)
MyFloat = MyFloat*FLOAT(MyWord*MyWord)
MyFloat = MyFloat*FLOAT(MyWord*MyByte)
32