Техническая Спецификация для 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
Модели
198805
option float
define LIGHT as port[16]
define WV1 as word
define WV2 as word
define FV1 as float
define FRESULT as float
define IRESULT as word
LIGHT=off
LCD.INIT
FV1=exp(1.23456789,4) '1.23456789E03
WV1=1000
'*************************************************************************************************************
'*** FLOAT CONVERSION WITHIN A TERM ***
'**************************************************************************************************************
'------- TERM WITH FP-VARIABLE AND CONSTANT --------------------------
FRESULT=FV1*1000
LCD.POS 1,1
LCD.PRINT FRESULT & " VOLT "
'------- TERM WITH FP-VARIABLE AND WORD-Variable ----------------------
WV1=1000
FRESULT=FV1*FLOAT(WV1*10) 'Conversion WORD-> FLOAT !!
LCD.POS 2,1
LCD.PRINT FRESULT & " VOLT "
PAUSE 100
'**************************************************************************************************************
'*** INTEGER CONVERSION OF A TERMS ***
'**************************************************************************************************************
' Is not allowed and nust be done my conversion of variables
'------- TERM WITH FP-VARIABLE AND CONSTANTE --------------------------
FV1=5678.234
IRESULT=INT(FV1)/1000
LCD.POS 1,1
LCD.PRINT IRESULT & " VOLT "
'------- TERM WITH FP-VARIABLE AND WORD-Variable ----------------------
WV1=1000
IRESULT=3*INT(FV1)/WV1 'Conversion FLOAT-> WORD
LCD.POS 2,1
LCD.PRINT IRESULT & " VOLT "
PAUSE 100
define LIGHT as port[16]
define WV1 as word
define WV2 as word
define FV1 as float
define FRESULT as float
define IRESULT as word
LIGHT=off
LCD.INIT
FV1=exp(1.23456789,4) '1.23456789E03
WV1=1000
'*************************************************************************************************************
'*** FLOAT CONVERSION WITHIN A TERM ***
'**************************************************************************************************************
'------- TERM WITH FP-VARIABLE AND CONSTANT --------------------------
FRESULT=FV1*1000
LCD.POS 1,1
LCD.PRINT FRESULT & " VOLT "
'------- TERM WITH FP-VARIABLE AND WORD-Variable ----------------------
WV1=1000
FRESULT=FV1*FLOAT(WV1*10) 'Conversion WORD-> FLOAT !!
LCD.POS 2,1
LCD.PRINT FRESULT & " VOLT "
PAUSE 100
'**************************************************************************************************************
'*** INTEGER CONVERSION OF A TERMS ***
'**************************************************************************************************************
' Is not allowed and nust be done my conversion of variables
'------- TERM WITH FP-VARIABLE AND CONSTANTE --------------------------
FV1=5678.234
IRESULT=INT(FV1)/1000
LCD.POS 1,1
LCD.PRINT IRESULT & " VOLT "
'------- TERM WITH FP-VARIABLE AND WORD-Variable ----------------------
WV1=1000
IRESULT=3*INT(FV1)/WV1 'Conversion FLOAT-> WORD
LCD.POS 2,1
LCD.PRINT IRESULT & " VOLT "
PAUSE 100
34