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
Mixed Data Types as below shown are not supported: 
 
MyFloat = MyFloat*FLOAT(MyWord)*MyWord 
Will lead to wrong results 
 
MyFloat = MyWord 
Will lead to stackerrrors and related trouble 
 
 
 
 
INT 
Conversion of a FlOAT varaiable to INTEGER/BYTE Type 
 
Here it is not possible to convert a Term. There always only a variable can be converted. 
 
 
MyWord = INT(MyFloat) 
MyWord = 3*INT(MyFloat)/MyWord 
MyByte = 3*INT(MyFloat)/MyWord 
 
 
 
 
 
 This is a samle of a invalid conversion: 
 MyWord=INT(MyFloat/MyFloat) 
 
Traps: 
It is emient always toconsider the different data type ranges when converting. See the samples for 
details. 
 
 
MyFloat1=50000 
MyFloat2=30000 
MyWord=1000 
 
Case1: 
   INT_RESULT=INT(MyFloat) 
The value may be larger than it is possible for word type variables 
 
 
 
Case2: 
   INT_RESULT=INT(MyFloat)/MyWord  
Even though the result (5000) is not too large for a WORD, the value may overflow the WORD before 
division 
 
 
Case 3: 
 INT_RESULT=10*INT(MyFloat2)/MyWord  
Here an overflow may occur at the multiplication 10*INT(30000) 
 
INT_RESULT=INT(MyFloat2)/MyWord*10      
This will show the right result  
 
 
      
 
 
 
 
 
 
 
33