Files
HundM_Fortna/=A01+UH01-KF00/Programmbausteine/_IBN/FB_TestMain.scl
T

87 lines
3.2 KiB
Plaintext

FUNCTION_BLOCK "FB_TestMain"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
VAR
rTrigPUT {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG;
rTrigGET {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG;
END_VAR
BEGIN
IF "DB_Test".xBit THEN
"DB_Test".rTimeResult := RUNTIME("DB_Test".rTimeMem);
"FC_BARCODE_SEARCH"(nInArea := "DB_Test".nSearchInStore,
xInActive := "DB_Test".xBit,
xOutNewRetrieve => "DB_Test".xNewRetrieve,
nOutMissingBarcode => "DB_Test".nMissingBarcode,
xOutError => "DB_Test".xError,
nOutStatus => "DB_Test".nStatus,
InOutTest := "DB_Test".arTest,
InOutStructRetrieve := "DB_Test".stRetrieve,
InOutLocalized := "DB_Test".stResult);
"DB_Test".xBit := FALSE;
"DB_Test".rTimeResult := RUNTIME("DB_Test".rTimeMem);
END_IF;
IF "DB_Test".xActivate THEN
"DB_Test".rTimeResult := RUNTIME("DB_Test".rTimeMem);
"FC_CARR_GLOB_CORRECTION"(xInStart := "DB_Test".xActivate,
nInBarcodeScan := "DB_Test".stCarrScan.nBarcode,
nInStation:= 0,
arOutEventLogInfo => "DB_Test".arCorrectionInfo,
InOutCarrierExpect := "DB_Test".stCarrExpect);
"DB_Test".xActivate := FALSE;
"DB_Test".rTimeResult := RUNTIME("DB_Test".rTimeMem);
END_IF;
REGION S7
REGION PUT
#rTrigPUT(CLK := "DB_S7".stFunction.stPut.xStart);
IF #rTrigPUT.Q THEN
"DB_Test".rTimeResult := RUNTIME("DB_Test".rTimeMem);
END_IF;
"PUT_DB"(REQ := "DB_S7".stFunction.stPut.xStart,
ID := W#16#118,
ADDR_1 := P#DB99.DBX14.0 BYTE 1,//Partner
SD_1 := "DB_S7".stSnd);//Quelle
IF "PUT_DB".ERROR THEN
"DB_S7".stFunction.stPut.xError := "PUT_DB".ERROR;
END_IF;
IF "PUT_DB".STATUS <> 0 THEN
"DB_S7".stFunction.stPut.wStatus := "PUT_DB".STATUS;
END_IF;
IF "PUT_DB".DONE THEN
"DB_Test".rTimeResult := RUNTIME("DB_Test".rTimeMem);
"DB_S7".stFunction.stPut.xStart := FALSE;
END_IF;
END_REGION
REGION GET
#rTrigGET(CLK := "DB_S7".stFunction.stGet.xStart);
IF #rTrigGET.Q THEN
"DB_Test".rTimeResult := RUNTIME("DB_Test".rTimeMem);
END_IF;
"GET_DB"(REQ := "DB_S7".stFunction.stGet.xStart,
ADDR_1 := P#DB99.DBX40.0 INT 400,//Partner CPU
RD_1 := "DB_S7".aaa, //Eigene CPU
ID := W#16#118);
IF "GET_DB".ERROR THEN
"DB_S7".stFunction.stGet.xError := "GET_DB".ERROR;
END_IF;
IF "GET_DB".STATUS <> 0 THEN
"DB_S7".stFunction.stGet.wStatus := "GET_DB".STATUS;
END_IF;
IF "GET_DB".NDR THEN
"DB_Test".rTimeResult := RUNTIME("DB_Test".rTimeMem);
"DB_S7".stFunction.stGet.xStart := FALSE;
END_IF;
END_REGION
END_REGION
END_FUNCTION_BLOCK