FUNCTION_BLOCK FB 100
VAR_INPUT
VALUE : REAL ; // Measured value per time interval
INTERVAL : TIME ; // Time interval unit of measurement
CYCLE : TIME ; // Sampling time
COM_RST : BOOL ; // Clear accumulated total
END_VAR
VAR_OUTPUT
TOTAL : REAL ; // Accumulated total value
END_VAR
VAR
ACCUM : REAL ; // Accumulated total value (static storage)
END_VAR
VAR_TEMP
tINTERVAL : REAL ; // Temp. time INTERVAL in REAL format
tCYCLE : REAL ; // Temp. CYCLE time in REAL format
END_VAR
BEGIN
NETWORK
TITLE =check for a complete reset
u #COM_RST;錯誤
spbn nw2;錯誤
L 0.000000e+000;
T #ACCUM;
T #TOTAL;
SET ;
SAVE ;
BEa ; 錯誤
NETWORK
TITLE =convert INTERVAL and CYCLE to REAL numbers
nw2: NOP 0;
L #INTERVAL;
DTR ;
T #tINTERVAL;
L #CYCLE;
DTR ;
T #tCYCLE;
NETWORK
TITLE =add incremental value to accumulated and total values
L #VALUE;
L #tCYCLE;
*R ;
L #tINTERVAL;
/R ;
// now that incremental value is calculated,
// add this to the accumulated value
// and send it to the output TOTAL
L #ACCUM;
+R ;
T #ACCUM;
T #TOTAL;
NETWORK
TITLE =exit
SET ;
SAVE ;
Bea ; 錯誤
END_FUNCTION_BLOCK
上面有四個錯誤,編譯通不過,不知道要怎么改?但是下裝時卻能用?