Skip to content

Instantly share code, notes, and snippets.

@nikvoronin
Last active January 3, 2021 21:53
Show Gist options
  • Save nikvoronin/b93b4b448e699798a4e390f53857f878 to your computer and use it in GitHub Desktop.
Save nikvoronin/b93b4b448e699798a4e390f53857f878 to your computer and use it in GitHub Desktop.
Testing of the TwinCAT3 POU FB_FileLoad from Tc2_System
PROGRAM MAIN
VAR
START: BOOL;
FileLoad: FB_FileLoad;
bigBuf: ARRAY[0..35000000] OF BYTE;
timeCounter: UDINT;
GetRouterStatusInfo: FB_GetRouterStatusInfo;
RouterStatusInfo: ST_TcRouterStatusInfo;
END_VAR
VAR CONSTANT
BIG_FILENAME: STRING := '/Hard Disk/NK.BIN'; // ~32.7Mb
END_VAR
FileLoad.sPathName := BIG_FILENAME;
FileLoad.pReadBuff := ADR(bigBuf);
FileLoad.cbReadLen := SIZEOF(bigBuf);
FileLoad.tTimeout := T#1H;
FileLoad(sNetId:= '', bExecute:= START);
IF FileLoad.bBusy THEN
timeCounter := timeCounter + 1;
ELSE
START := FALSE;
END_IF
GetRouterStatusInfo(sNetId:= '', bExecute:= TRUE);
IF NOT GetRouterStatusInfo.bBusy THEN
GetRouterStatusInfo(sNetId:= '', bExecute:= FALSE);
RouterStatusInfo := GetRouterStatusInfo.info;
END_IF
END_PROGRAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment