Title
Snap7
Reference manual
Davide Nardella
Rev.6 – June 3, 2015
P a g . | 2
Snap7 1.4.0 - Reference manual
P a g . 2 |
Snap7 1.4.0 - Reference manual
Summary
Title ....................................................................................................................... 1
Summary ............................................................................................................... 2
Overview ................................................................................................................ 9
Licensing .............................................................................................................. 10
Disclaimer of Warranty ........................................................................................... 10
Acnowledgments ................................................................................................... 11
About this manual ................................................................................................. 12
Convention ........................................................................................................... 12
Snap7 Compatibility ............................................................................................... 13
OS ....................................................................................................................... 13
Wrappers .............................................................................................................. 14
Siemens communications overview .......................................................................... 17
S7 Protocol ........................................................................................................... 17
The Siemens theatre .............................................................................................. 19
Siemens data format .............................................................................................. 22
Helper classes ....................................................................................................... 22
The Snap7 theatre ................................................................................................. 24
Snap7Client .......................................................................................................... 25
PDU independence ............................................................................................. 26
SmartConnect ................................................................................................... 26
Asynchronous data transfer ................................................................................ 28
Target Compatibility ........................................................................................... 33
S7 1200/1500 Notes .......................................................................................... 34
Snap7MicroClient ............................................................................................... 36
PLC connection .................................................................................................. 37
Snap7Server ......................................................................................................... 39
Introduction ...................................................................................................... 39
Specifications .................................................................................................... 43
Control flow ...................................................................................................... 45
Data consistency ............................................................................................... 50
Resourceless servers .......................................................................................... 51
Multiple servers ................................................................................................. 52
Troubleshooting ................................................................................................. 53
Step 7 Project ................................................................................................... 54
Server Applications ............................................................................................ 58
Snap7Partner ........................................................................................................ 59
P a g . | 3
Snap7 1.4.0 - Reference manual
P a g . 3 |
Snap7 1.4.0 - Reference manual
The Siemens model............................................................................................ 59
The Snap7 model ............................................................................................... 63
Partner use ....................................................................................................... 65
Partner Applications ........................................................................................... 74
News from 1.1.0 .................................................................................................... 76
LOGO! 0BA7/0BA8 ............................................................................................. 76
S7 200 (via CP243) ............................................................................................ 83
Snap7 Library API .................................................................................................. 85
API conventions..................................................................................................... 85
Wrappers .............................................................................................................. 85
LabVIEW .......................................................................................................... 88
Accessing internal parameters ................................................................................. 89
Client API Reference .............................................................................................. 91
Administrative functions ......................................................................................... 92
Cli_Create ......................................................................................................... 93
Cli_Destroy ....................................................................................................... 94
Cli_SetConnectionType ....................................................................................... 95
Cli_ConnectTo ................................................................................................... 96
Cli_SetConnectionParams ................................................................................... 98
Cli_Connect ...................................................................................................... 99
Cli_Disconnect .................................................................................................. 100
Cli_GetParam ................................................................................................... 101
Cli_SetParam ................................................................................................... 102
Data I/O functions ................................................................................................ 103
Cli_ReadArea ................................................................................................... 104
Cli_WriteArea ................................................................................................... 106
Cli_DBRead ...................................................................................................... 107
Cli_DBWrite ..................................................................................................... 108
Cli_ABRead ...................................................................................................... 109
Cli_ABWrite ...................................................................................................... 110
Cli_EBRead ...................................................................................................... 111
Cli_EBWrite ...................................................................................................... 112
Cli_MBRead ...................................................................................................... 113
Cli_MBWrite ..................................................................................................... 114
Cli_TMRead ...................................................................................................... 115
Cli_TMWrite ..................................................................................................... 116
Cli_CTRead ...................................................................................................... 117
P a g . | 4
Snap7 1.4.0 - Reference manual
P a g . 4 |
Snap7 1.4.0 - Reference manual
Cli_CTWrite ...................................................................................................... 118
Cli_ReadMultiVars ............................................................................................. 119
Cli_WriteMultiVars ............................................................................................ 121
Directory functions ............................................................................................... 122
Cli_ListBlocks ................................................................................................... 123
Cli_ListBlocksOfType ......................................................................................... 124
Cli_GetAgBlockInfo ........................................................................................... 126
Cli_GetPgBlockInfo ........................................................................................... 128
Block oriented functions ........................................................................................ 129
Cli_FullUpload .................................................................................................. 130
Cli_Upload ....................................................................................................... 132
Cli_Download ................................................................................................... 133
Cli_Delete ........................................................................................................ 134
Cli_DBGet ........................................................................................................ 135
Cli_DBFill ......................................................................................................... 136
Date/Time functions .............................................................................................. 137
Cli_GetPlcDateTime ........................................................................................... 138
Cli_SetPlcDateTime ........................................................................................... 139
Cli_SetPlcSystemDateTime ................................................................................ 140
System info functions ............................................................................................ 141
Cli_ReadSZL .................................................................................................... 142
Cli_ReadSZLList ................................................................................................ 144
Cli_GetOrderCode ............................................................................................. 146
Cli_GetCpuInfo ................................................................................................. 147
Cli_GetCpInfo ................................................................................................... 148
PLC control functions ............................................................................................ 149
Cli_PlcHotStart ................................................................................................. 150
Cli_PlcColdStart ................................................................................................ 151
Cli_PlcStop ...................................................................................................... 152
Cli_CopyRamToRom .......................................................................................... 153
Cli_Compress ................................................................................................... 154
Cli_GetPlcStatus ............................................................................................... 155
Security functions ................................................................................................. 156
Cli_SetSessionPassword .................................................................................... 157
Cli_ClearSessionPassword .................................................................................. 158
Cli_GetProtection .............................................................................................. 159
Low level functions ............................................................................................... 160
P a g . | 5
Snap7 1.4.0 - Reference manual
P a g . 5 |
Snap7 1.4.0 - Reference manual
Cli_IsoExchangeBuffer ....................................................................................... 161
Miscellaneous functions ......................................................................................... 162
Cli_GetExecTime ............................................................................................... 163
Cli_GetLastError ............................................................................................... 164
Cli_GetPduLength ............................................................................................. 165
Cli_ErrorText .................................................................................................... 166
Cli_GetConnected ............................................................................................. 167
Asynchronous functions ......................................................................................... 168
Cli_SetAsCallback ............................................................................................. 169
Cli_CheckAsCompletion ..................................................................................... 173
Cli_WaitAsCompletion ....................................................................................... 174
Cli_AsReadArea ................................................................................................ 175
Cli_AsWriteArea ................................................................................................ 176
Cli_AsDBRead .................................................................................................. 177
Cli_AsDBWrite .................................................................................................. 178
Cli_AsABRead ................................................................................................... 179
Cli_AsABWrite .................................................................................................. 180
Cli_AsEBRead ................................................................................................... 181
Cli_AsEBWrite .................................................................................................. 182
Cli_AsMBRead .................................................................................................. 183
Cli_AsMBWrite .................................................................................................. 184
Cli_AsTMRead .................................................................................................. 185
Cli_AsTMWrite .................................................................................................. 186
Cli_AsCTRead ................................................................................................... 187
Cli_AsCTWrite .................................................................................................. 188
Cli_AsListBlocksOfType ...................................................................................... 189
Cli_AsReadSZL ................................................................................................. 190
Cli_AsReadSZLList ............................................................................................ 191
Cli_AsFullUpload ............................................................................................... 192
Cli_AsUpload .................................................................................................... 193
Cli_AsDownload ................................................................................................ 194
Cli_AsDBGet .................................................................................................... 195
Cli_AsDBFill...................................................................................................... 196
Cli_AsCopyRamToRom ...................................................................................... 197
Cli_AsCompress ................................................................................................ 198
Server API Reference ............................................................................................ 199
Administrative functions ........................................................................................ 200