Commissioning
nSTATE_WRITE_COE := 0;
END_IF
END_CASE
ELSE
nSTATE_WRITE_COE := 0;
END_IF
END_IF
IF(fb_coe_write.bError) AND NOT bError THEN
bError := TRUE;
nADSErrId := fb_coe_write.nErrId;
// CoE write acccess error occured: reset all
nSTATE_WRITE_COE := nMainCal_State := 0;
bScaleOffsetDone := bScaleOffsetStart := FALSE;
bScaleGainDone := bScaleGainStart := FALSE;
END_IF
4.3.1.1
Function block FB_GET_MIN_MAX
Declaration part:
FUNCTION_BLOCK FB_GET_MIN_MAX
VAR CONSTANT
CMAXinit :REAL := -3.402823E+38;
CMINinit :REAL := 3.402823E+38;
END_VAR
VAR_INPUT
bInit :BOOL := TRUE;
nInputValue :REAL;
nMinFreqInput :REAL;
END_VAR
VAR_OUTPUT
bRESULT :BOOL;
nMaxVal :REAL;
nMinVal :REAL;
END_VAR
VAR
CMMcnt :UINT;
nMaxValCnt :UINT;
nMinValCnt :UINT;
bValidMinVal :BOOL;
bValidMaxVal :BOOL;
fbGetCurTaskIdx : GETCURTASKINDEX;
END_VAR
Execution part:
IF bInit THEN
// Counter initialization:
// [counter value] > [1/(<input frequency> * TaskCycleTime)]
fbGetCurTaskIdx();
CMMcnt := REAL_TO_UINT(
1.1E7/(nMinFreqInput*UDINT_TO_REAL(
_TaskInfo[fbGetCurTaskIdx.index].CycleTime)));
// At least an entire period have to be sampled for min/max determination
90
Version: 1.2
EPP3504-0023