Title
Snap7
Reference manual
Davide Nardella
Rev.1 – September 3, 2013
P a g . | 2
Snap7 1.0.0 - Reference manual
P a g . 2 |
Snap7 1.0.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
The Snap7 theatre ................................................................................................. 22
Snap7Client .......................................................................................................... 23
PDU independence ............................................................................................. 24
SmartConnect ................................................................................................... 24
Asynchronous data transfer ................................................................................ 26
Target Compatibility ........................................................................................... 31
S7 1200/1500 Notes .......................................................................................... 32
Snap7MicroClient ............................................................................................... 34
Snap7Server ......................................................................................................... 35
Introduction ...................................................................................................... 35
Specifications .................................................................................................... 39
Control flow ...................................................................................................... 41
Data consistency ............................................................................................... 46
Multiple servers ................................................................................................. 47
Troubleshooting ................................................................................................. 48
Step 7 Project ................................................................................................... 49
Server Applications ............................................................................................ 53
Snap7Partner ........................................................................................................ 54
The Siemens model............................................................................................ 54
The Snap7 model ............................................................................................... 58
Partner use ....................................................................................................... 60
Partner Applications ........................................................................................... 69
P a g . | 3
Snap7 1.0.0 - Reference manual
P a g . 3 |
Snap7 1.0.0 - Reference manual
Snap7 Library API .................................................................................................. 71
API conventions..................................................................................................... 71
Wrappers .............................................................................................................. 71
LabVIEW .......................................................................................................... 74
Accessing internal parameters ................................................................................. 75
Client API Reference .............................................................................................. 77
Administrative functions ......................................................................................... 78
Cli_Create ......................................................................................................... 79
Cli_Destroy ....................................................................................................... 80
Cli_ConnectTo ................................................................................................... 81
Cli_Connect ...................................................................................................... 83
Cli_Disconnect ................................................................................................... 84
Cli_GetParam .................................................................................................... 85
Cli_SetParam .................................................................................................... 86
Data I/O functions ................................................................................................. 87
Cli_ReadArea .................................................................................................... 88
Cli_WriteArea .................................................................................................... 90
Cli_DBRead ....................................................................................................... 91
Cli_DBWrite ...................................................................................................... 92
Cli_ABRead ....................................................................................................... 93
Cli_ABWrite ....................................................................................................... 94
Cli_EBRead ....................................................................................................... 95
Cli_EBWrite ....................................................................................................... 96
Cli_MBRead ....................................................................................................... 97
Cli_MBWrite ...................................................................................................... 98
Cli_TMRead ....................................................................................................... 99
Cli_TMWrite ..................................................................................................... 100
Cli_CTRead ...................................................................................................... 101
Cli_CTWrite ...................................................................................................... 102
Cli_ReadMultiVars ............................................................................................. 103
Cli_WriteMultiVars ............................................................................................ 105
Directory functions ............................................................................................... 106
Cli_ListBlocks ................................................................................................... 107
Cli_ListBlocksOfType ......................................................................................... 108
Cli_GetAgBlockInfo ........................................................................................... 110
Cli_GetPgBlockInfo ........................................................................................... 112
Block oriented functions ........................................................................................ 113
P a g . | 4
Snap7 1.0.0 - Reference manual
P a g . 4 |
Snap7 1.0.0 - Reference manual
Cli_FullUpload .................................................................................................. 114
Cli_Upload ....................................................................................................... 116
Cli_Download ................................................................................................... 117
Cli_Delete ........................................................................................................ 118
Cli_DBGet ........................................................................................................ 119
Cli_DBFill ......................................................................................................... 120
Date/Time functions .............................................................................................. 121
Cli_GetPlcDateTime ........................................................................................... 122
Cli_SetPlcDateTime ........................................................................................... 123
Cli_SetPlcSystemDateTime ................................................................................ 124
System info functions ............................................................................................ 125
Cli_ReadSZL .................................................................................................... 126
Cli_ReadSZLList ................................................................................................ 128
Cli_GetOrderCode ............................................................................................. 130
Cli_GetCpuInfo ................................................................................................. 131
Cli_GetCpInfo ................................................................................................... 132
PLC control functions ............................................................................................ 133
Cli_PlcHotStart ................................................................................................. 134
Cli_PlcColdStart ................................................................................................ 135
Cli_PlcStop ...................................................................................................... 136
Cli_CopyRamToRom .......................................................................................... 137
Cli_Compress ................................................................................................... 138
Cli_GetPlcStatus ............................................................................................... 139
Security functions ................................................................................................. 140
Cli_SetSessionPassword .................................................................................... 141
Cli_ClearSessionPassword .................................................................................. 142
Cli_GetProtection .............................................................................................. 143
Low level functions ............................................................................................... 144
Cli_IsoExchangeBuffer ....................................................................................... 145
Miscellaneous functions ......................................................................................... 146
Cli_GetExecTime ............................................................................................... 147
Cli_GetLastError ............................................................................................... 148
Cli_GetPduLength ............................................................................................. 149
Cli_ErrorText .................................................................................................... 150
Asynchronous functions ......................................................................................... 151
Cli_SetAsCallback ............................................................................................. 152
Cli_CheckAsCompletion ..................................................................................... 156
P a g . | 5
Snap7 1.0.0 - Reference manual
P a g . 5 |
Snap7 1.0.0 - Reference manual
Cli_WaitAsCompletion ....................................................................................... 157
Cli_AsReadArea ................................................................................................ 158
Cli_AsWriteArea ................................................................................................ 159
Cli_AsDBRead .................................................................................................. 160
Cli_AsDBWrite .................................................................................................. 161
Cli_AsABRead ................................................................................................... 162
Cli_AsABWrite .................................................................................................. 163
Cli_AsEBRead ................................................................................................... 164
Cli_AsEBWrite .................................................................................................. 165
Cli_AsMBRead .................................................................................................. 166
Cli_AsMBWrite .................................................................................................. 167
Cli_AsTMRead .................................................................................................. 168
Cli_AsTMWrite .................................................................................................. 169
Cli_AsCTRead ................................................................................................... 170
Cli_AsCTWrite .................................................................................................. 171
Cli_AsListBlocksOfType ...................................................................................... 172
Cli_AsReadSZL ................................................................................................. 173
Cli_AsReadSZLList ............................................................................................ 174
Cli_AsFullUpload ............................................................................................... 175
Cli_AsUpload .................................................................................................... 176
Cli_AsDownload ................................................................................................ 177
Cli_AsDBGet .................................................................................................... 178
Cli_AsDBFill...................................................................................................... 179
Cli_AsCopyRamToRom ...................................................................................... 180
Cli_AsCompress ................................................................................................ 181
Server API Reference ............................................................................................ 182
Administrative functions ........................................................................................ 183
Srv_Create ...................................................................................................... 184
Srv_Destroy ..................................................................................................... 185
Srv_GetParam .................................................................................................. 186
Srv_SetParam .................................................................................................. 187
Srv_StartTo ..................................................................................................... 188
Srv_Start ......................................................................................................... 189
Srv_Stop ......................................................................................................... 190
Shared memory functions ...................................................................................... 191
Srv_RegisterArea .............................................................................................. 192
Srv_UnRegisterArea .......................................................................................... 193