beckhoff · TX1200 · 120 pp.
Beckhoff TX1200 TwinCAT 2 PLC Library TcSystem Manual PDF
Related manuals
Contents
Document text
Manual | EN TX1200 TwinCAT 2 | PLC Library: TcSystem 2022-10-11 | Version: 1.1
Table of contents
Table of contents Table of contents 1 Foreword.................................................................................................................................................... 7 1.1 Notes on the documentation ............................................................................................................. 7 1.2 Safety instructions............................................................................................................................. 8 1.3 Notes on information security............................................................................................................
9 2 Overview .................................................................................................................................................. 10 3 Function blocks....................................................................................................................................... 14 3.1 ADS Function Blocks ...................................................................................................................... 14 3.1.1 ADSREAD........................................................................................................................
14 3.1.2 ADSWRITE ...................................................................................................................... 15 3.1.3 ADSRDWRT .................................................................................................................... 17 3.1.4 ADSRDSTATE................................................................................................................. 19 3.1.5 ADSWRTCTL................................................................................................................... 20 3.1.6 ADSRDDEVINFO.............................................................................................................
22 3.1.7 ADSREADEX................................................................................................................... 23 3.1.8 ADSRDWRTEX................................................................................................................ 25 3.2 Expanded ADS Function Blocks ..................................................................................................... 26 3.2.1 ADSREADIND.................................................................................................................. 27 3.2.2 ADSWRITEIND................................................................................................................
28 3.2.3 ADSRDWRTIND .............................................................................................................. 29 3.2.4 ADSREADRES ................................................................................................................ 31 3.2.5 ADSWRITERES............................................................................................................... 32 3.2.6 ADSRDWRTRES............................................................................................................. 33 3.2.7 Example 1: Expanded ADS function blocks..................................................................... 34 3.2.8 Example 2:
Expanded ADS function blocks..................................................................... 36 3.3 General Function Blocks ................................................................................................................. 39 3.3.1 DRAND ............................................................................................................................ 39 3.3.2 GETCURTASKINDEX...................................................................................................... 39 3.4 Time Function Blocks......................................................................................................................
40 3.4.1 GETSYSTEMTIME .......................................................................................................... 40 3.4.2 GETTASKTIME................................................................................................................ 41 3.4.3 GETCPUCOUNTER ........................................................................................................ 42 3.5 Watchdog Function Blocks.............................................................................................................. 43 3.4.4 GETCPUACCOUNT ........................................................................................................
42 3.5.1 FB_PcWatchdog .............................................................................................................. 43 3.6 File Function Blocks ........................................................................................................................ 45 3.6.1 FB_EOF ........................................................................................................................... 45 3.6.2 FB_FileClose.................................................................................................................... 46 3.6.3 FB_FileDelete ..................................................................................................................
47 3.6.4 FB_FileGets ..................................................................................................................... 49 3.6.5 FB_FileOpen.................................................................................................................... 50 3.6.6 FB_FilePuts...................................................................................................................... 53 3.6.7 FB_FileRead .................................................................................................................... 54 3.6.8 FB_FileRename ...............................................................................................................
56 3.6.9 FB_FileSeek..................................................................................................................... 57 TX1200 3 Version: 1.1
Table of contents
Table of contents 3.6.10 FB_FileTell....................................................................................................................... 59 3.6.11 FB_FileWrite .................................................................................................................... 60 3.6.12 Example: File access from the PLC................................................................................. 62 3.6.13 FB_CreateDir ................................................................................................................... 65 3.6.14 FB_RemoveDir.................................................................................................................
67 3.6.15 TwinCAT 2.7 file function blocks...................................................................................... 68 3.7 IEC steps / SFC flags function blocks ............................................................................................. 75 3.7.1 SFCActionControl ............................................................................................................ 75 3.7.2 AnalyzeExpression........................................................................................................... 75 3.7.3 AnalyzeExpressionCombined ..........................................................................................
76 3.7.4 AppendErrorString ........................................................................................................... 76 3.8 Eventlogger function blocks ............................................................................................................ 77 3.8.1 ADSLOGEVENT .............................................................................................................. 77 3.8.2 ADSCLEAREVENTS ....................................................................................................... 80 4 Functions .................................................................................................................................................
82 4.1 General Functions........................................................................................................................... 82 4.1.1 F_SplitPathName............................................................................................................. 82 4.1.2 F_CreateIPv4Addr ........................................................................................................... 83 4.1.3 F_ScanIPv4AddrIds ......................................................................................................... 83 4.1.4 SETBIT32.........................................................................................................................
84 4.1.5 CSETBIT32...................................................................................................................... 85 4.1.6 GETBIT32 ........................................................................................................................ 86 4.1.7 CLEARBIT32.................................................................................................................... 86 4.1.8 LPTSIGNAL ..................................................................................................................... 87 4.1.9 F_GetStructMemberAlignment.........................................................................................
88 4.1.10 F_GetVersionTcSystem................................................................................................... 90 4.2 I/O port access ................................................................................................................................ 91 4.2.1 F_IOPortRead.................................................................................................................. 91 4.3 ADS Functions ................................................................................................................................
93 4.2.2 F_IOPortWrite .................................................................................................................. 91 4.3.1 ADSLOGDINT.................................................................................................................. 93 4.3.2 ADSLOGLREAL............................................................................................................... 95 4.3.3 ADSLOGSTR................................................................................................................... 96 4.3.4 F_CreateAmsNetId ..........................................................................................................
98 4.3.5 F_ScanAmsNetIds ........................................................................................................... 98 4.4 MEMORY functions......................................................................................................................... 99 4.4.1 MEMCMP......................................................................................................................... 99 4.4.2 MEMCPY ....................................................................................................................... 100 4.4.3 MEMSET........................................................................................................................
101 4.4.4 MEMMOVE .................................................................................................................... 102 4.5 Character functions ....................................................................................................................... 103 4.5.1 F_ToCHR....................................................................................................................... 103 4.5.2 F_ToASC .......................................................................................................................
104 5 Data structures...................................................................................................................................... 106 5.1 SYSTEMINFOTYPE...................................................................................................................... 106 TX1200 4 Version: 1.1
Table of contents
Table of contents 5.2 SYSTEMTASKINFOTYPE ............................................................................................................ 107 5.3 T_AmsNetId .................................................................................................................................. 107 5.4 T_AmsNetIdArr ............................................................................................................................. 108 5.5 T_AmsPort ....................................................................................................................................
108 5.6 T_MaxString.................................................................................................................................. 109 5.7 T_IPv4Addr ................................................................................................................................... 109 5.8 T_IPv4AddrArr .............................................................................................................................. 109 5.9 ST_AmsAddr.................................................................................................................................
110 5.10 E_OpenPath.................................................................................................................................. 110 5.11 E_SeekOrigin ................................................................................................................................ 110 5.12 E_TcEventClass............................................................................................................................ 111 5.13 E_TcEventClearModes .................................................................................................................
111 5.14 E_TcEventPriority ......................................................................................................................... 111 5.15 E_TcEventStreamType ................................................................................................................. 112 5.16 E_IOAccessSize ........................................................................................................................... 112 5.17 TcEvent .........................................................................................................................................
112 5.18 PVOID ........................................................................................................................................... 113 5.19 UXINT............................................................................................................................................ 113 5.20 XINT .............................................................................................................................................. 114 5.21 XWORD.........................................................................................................................................
114 6 Constants............................................................................................................................................... 115 TX1200 5 Version: 1.1