beckhoff TwinCAT 3 — 4.3.3 PLC function blocks relating to the storage function of the license dongles

Working with TwinCAT 3 license dongles VAR_INPUT sNetId : T_AmsNetId;(* Ams net id of dongle (USB: of PC ('' is local PC); EL6070: of EtherCAT Master (info data of terminal)) *) nPort : UINT; (* Ams port of dongle (USB: ADS Port of ESB Device (e.g. 16#7100); EL6070: ADS Port of EtherCAT terminal (info data)) *) sFileName : STRING; (* File name to delete from dongle *) bExecute : BOOL; (* Rising edge on this input activates the fb execution *) dwPassCode : DWORD; (* Passcode for file access *) tTimeout : TIME := DEFAULT_ADS_TIMEOUT;(* ADS timeout *) END_VAR VAR_OUTPUT bBusy : BOOL; (* True as long as the FB is busy *) bError : BOOL; (* True in case of an error *) nErrorId :

UDINT; (* Error code in case of an error *) END_VAR Reading a file from the terminal/USB dongle FUNCTION_BLOCK FB_LicFileRead The function block reads a file from the license dongle to a buffer (pDestBuff and cbReadLen) via a positive edge at bExecute. The buffer must be large enough for the file, otherwise only the first part of the file is read. VAR_INPUT sNetId : T_AmsNetId;(* Ams net id of dongle (USB: of PC ('' is local PC); EL6070: of EtherCAT Master (info data of terminal)) *) nPort : UINT; (* Ams port of dongle (USB: ADS Port of ESB Device (e.g. 16#7100); EL6070: ADS Port of EtherCAT terminal (info data)) *) sFileName : STRING; (* File name to write to dongle *) pDestBuff :

PVOID; (* Buffer address for read *) cbReadLen : UDINT; (* Count of bytes for read *) bExecute : BOOL; (* Rising edge on this input activates the fb execution *) dwPassCode : DWORD; (* Passcode for file access *) tTimeout : TIME := DEFAULT_ADS_TIMEOUT;(* ADS timeout *) END_VAR VAR_OUTPUT bBusy : BOOL; (* True as long as the FB is busy *) bError : BOOL; (* True in case of an error *) nErrorId : UDINT; (* Error code in case of an error *) END_VAR Copying a file from the hard disk to the terminal/USB dongle FUNCTION_BLOCK FB_LicFileCopyToDongle The function block copies a file from the hard disk to the license dongle.

If the file is larger than the buffer (cbCopyLen), the file copying procedure is automatically split into several read and write operations until the whole file is copied. Only then does bBusy switch to FALSE. VAR_INPUT sNetIdSrc : T_AmsNetId; (* Ams net id of PC ('' is local PC) *) sNetIdDest : T_AmsNetId; (* Ams net id of dongle (USB: of PC ('' is local PC); EL6070: of EtherCAT Master (info data of terminal)) *) nPortDest : UINT; (* Ams port of dongle (USB: ADS Port of ESB Device (e.g. 16#7100); EL6070: ADS Port of EtherCAT terminal (info data)) *) sFilePathNameSrc : T_MaxString; (* File path name on disk *) sFileNameDest : STRING; (* File name for file on dongle *) pCopyBuff :

PVOID; (* Buffer address for write *) cbCopyLen : UDINT; (* Count of bytes for write *) bExecute : BOOL; (* Rising edge on this input activates the fb execution *) dwPassCode : DWORD; (* Passcode for file access *) tTimeout : TIME := DEFAULT_ADS_TIMEOUT;(* ADS timeout *) END_VAR VAR_OUTPUT bBusy : BOOL; (* True as long as the FB is busy *) bError : BOOL; (* True in case of an error *) nErrorId : UDINT; (* Error code in case of an error *) END_VAR Copying a file from the terminal/USB dongle to the HDD FUNCTION_BLOCK FB_LicFileCopyFromDongle The function block copies a file from the license dongle to the hard disk.

If the file is larger than the buffer (cbCopyLen), the file copying procedure is automatically split into several read and write operations until the whole file is copied. Only then does bBusy switch to FALSE. TwinCAT 3 41 Version: 1.20.7