实例介绍
西门子PLC的开源通信库,基于以太网(Ethernet)通信的Snap7系列通信库是一个相当不错的选择。 这款通信库支持包括S7系列的S7-200、S7-200 Smart、S7-300、S7-400、S7-1200以及S7-1500的以太网通信。 支持的编程语言包括了C/C++、C#、Pascal、Python、Java、LabVIEW、Node.js。 多平台支持,包括Windows ( NT 4.0 -Windows 10), Linux, BSD, Oracle Solaris 11, Apple OSX
P a 33 Snap 1.0.0- Reference manua Snap/ Library APi API conventionsw71 Wrappers,,,,…,,,,,,,,,,,…,,,…,,,,,,,,,,,71 Labview 74 Accessing internal parameters D重面1重1D1面面国1面国1面重 75 Client APi Reference Administrative functions 78 Cli Create 79 Cli_Destroy……,…, 面重重通 80 Cli ConnectTo 81 Cli Connect 重1D重1D1D面面1重面 83 Cli Disconnect i重 1D重面面 84 Cli GetParam 85 Cli SetParam 面1面11面面1重面 ∴86 Data I/O functions 87 Cli ReadArea 88 Cli Writearea 90 Cli Bread...,,,,,,,,,, 1面重 91 Cli dbwrite 92 Cli ABRead 93 Cli AbWrite 1重重 1面 94 Cli bread ∴95 Cli EbWrite 96 Cli BREad 97 Cli MBwrite 98 Cli TREad, 99 Cli tmwrite ,100 Cli TREad 101 Cli CTWrite 102 Cli Read Multi\∨ars 103 Cli WriteMultiVars 105 Directory functions 106 Cli Listblocks∴ 107 Cli_listBlocksofType 108 Cli GetAg BlockInfo .110 Cli GetPgB| ockInfo… 112 Block oriented functions 113 Pag. 3 Snap 1.0.0- Reference manual P a Snap 1.0.0- Reference manua CliFullUpload 114 Cli Upload 4116 Cli Download 117 Cli Delete .118 Cli DBGet Cli DBfill 120 Date/Time functions. 121 Cli GetPlcDateTime 122 Cli SetPlcDateTime 面重重通 123 Cli_SetPlcsystemDateTime..... 124 System info functions. 重1D重1D1D面面1重面 125 Cli ReadszL i重 126 Cli ReadszlList 128 Cli GetorderCode.,, ..., 面1面11面面1重面 130 Cli GetcpuInfo ..131 Cli GetcpInfo 132 PLC control functions 133 Cli plcHotstart 134 Cli plcColdstart .135 Cli_PlcStop 136 Cli Copy RamToRo 137 Cli Compress 138 Ciⅰ GetPlcstatus, 139 Security functions.......... 140 Cli setsession Password 141 Cli ClearSession password .142 CGetProtection,143 Low evel functions 144 ClIsoEXchangeBuffer∴,,,,,,,,,,,,,,,,,,145 Misce‖ aneous functⅰons∴ ,146 Cli GetEⅹ ctime 147 Cli Getlasterror 148 Cli GetPduLength… 149 Cli ErrorText 150 Asynchronous functions .151 Cli setAscallback ,152 Cli CheckAsCompletion........... 156 P a g, 4 Snap 1.0.0- Reference manual P a 5 Snap 1.0.0- Reference manua Cli Completion...... 157 Cli AsReadarea 158 Cli AsWriteArea440499999...159 Cli AsDBRead 160 Cli AsDbwrite∴161 Cli AsABread 162 Cli asabwrite∴, 163 Cli AsEBRead. ................. 164 Cli AsebWrite 面重重通 165 Cli AsMBRead∴ 166 Cli AsMBWrite 重1D重1D1D面面1重面 167 Cli AsTmRead∴ i重 168 Cli AstmWrite 169 Cliⅰ AsCTRead, ∴170 Cli AsCTWrite 171 Cli_aslistBlocksofType 172 Cli asreadszL ∴173 Cli asreadszllist 1面重 174 Cli_ AsFullUpload 175 Cli AsUpload 176 Cli AsDownload 1重重 177 Cli AsDbget 178 Cli asDF‖ 179 Cli_AsCopy Ram ToRom.... .180 Cli AsCompress,.,.... 181 Server aPi reference 182 Administrative functions 酯1面1面面1重1面音1面面1面 183 Sry create ∴184 srv_ Destroy.,…,,,,,,,…,,…,…,…,,,,,,,,185 Sry getParam 186 Srv setParam 187 Sry startTo 188 Srv start 189 Srv_stop 190 Shared memory functions 191 Srv Registerarea ,192 Srv UnRegisterArea 193 Pag. 5 Snap 1.0.0- Reference manual P a Snap 1.0.0- Reference manua Sry lockArea 194 Sry UnlockArea 195 Control flow functions Sry setEvents Callback ∴.197 Sry netMask…199 Sry set Mask .200 Sry pick event∴, 201 Sry Clear Events ..202 Miscellaneous functions........IaaII..... 203 Sry getstatus 204 Srv_ setcpustatus∴ 重1D重1D1D面面1重面 205 Srv errorText i重 1D重面面 206 SrV EventText 207 Partner APi Reference 面1面11面面1重面 208 Administrative functions 209 Par create 210 Par Destroy .211 Par getParam 1面重 ∴212 Par setparam Par startto 214 Par start 1重重 215 Par_Stop 216 Par SetSend Callback 217 Par setRecvca‖!back. 218 Data transfer functions 219 Par send 220 Par asbsend 221 Par CheckAsBsendcompletio 222 Par_WaitAsBSend Completion . Par breck 224 Par_checkAsBRecvCompletion........ .225 Miscellaneous functions 26 Par GetTimes 227 Par getstats 228 Par getlasterror 229 Par getstatus∴ 230 Par ErrorText .231 P ag, 6 Snap 1.0.0- Reference manual P a Snap 1.0.0- Reference manua API Error codes 232 ISO TCP Error table 232 Client Errors table …………………233 Server Errors Table 234 Partner errors table234 Snap package 235 [build] .235 [doc]… ∴235 [examples] 面重重通 236 Trelease.,..................... 236 Library deploy…, 重1D重1D1D面面1重面 ∴236 Wrappers. i重 1D重面面 面1重重道1重11重 237 rich-demos 238 [src 面重重 ∴238 [LabVIEW] 238 LabViEw 239 DLL Calling 240 Generic buffers 1面重 240 Conventions 243 Graphic 24 Naming……… 1重重 243 Release 244 Final remarks 245 Testing snap/ 246 Snap source code..,........ ∴249 Embedding snap/MicroClient ∴250 Rebuild snap 251 Windows 251 Mingw 32bit 47.2 252 Mingw 64 bit 47.1 253 Microsoft visual studio .254 Embarcadero c++ builder 255 Unix 256 Linux x86/x64........... 氰.257 Linux arm boards ..258 BSD 259 Oracle solaris 11 260 Pag. 7 Snap 1.0.0- Reference manual P a 8 Snap 1.0.0- Reference manua P a g,& Snap 1.0.0- Reference manual P a 9 Snap 1.0.0- Reference manua Overview Snap is an open source multi-platform Ethernet communication suite for interfacing natively with Siemens S7 PLCs. The new CPUs 1200/1500 and SINAMICS Drives are also partially supported Although it has been designed to overcome the limitations of oPC servers when transferring large amounts of high speed data in industrial facilities, it scales well down to small Linux based arm boards such as Raspberry Pl, Beagle Bone black pcDuino and CubieBoard. Three specialized components, Client, Server and Partner, allow you to definitively integrate your pC based systems into a PLC automation chain Main features Native multi-architecture design (32/64 bit) Platform independent currently are supported Windows(from NT 4.0 up to Windows 8, Linux, BSD, Oracle Solaris 11 Fully scalable, starting from blade servers down to Raspberry Pi board No dependence on any third-party libraries no installation needed zero configuration Three different native thread models for performance optimization Win32 threads/ posix threads solaris 11 threads Two data transfer models: classic synchronous and asynchronous Two data flow models: polling and unsolicited(PLC transfers data when it wants to) Additional benefits Very easy to use, a full working server example is not bigger than the Hello world Hi level object oriented wrappers are provided, currently C/C++,. NET/Mono, Pascal, LabviEW, with many source code examples Multi-platform rich demos are provided Many projects/makefiles are ready to run to easily rebuild Snap in any platform without the need of be a C++ guru P ag, 9 Snap 1.0.0- Reference manual Pag.10 Snap 1.0.0- Reference manua Licensing Snap is distributed as a binary shared library with full source code under GNU Library or Lesser General Public License version 3.0(LGPLv3). Basically this means that you can distribute your commercial software linked with Snap, without the requirement to distribute the source code of your application and without the requirement that your application be itself distributed under LGPL. A small mention is however appreciated if you include it in your applications Disclaimer of Warranty THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM AS IS"WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING REPAIR OR CORRECTION IF ANYONE BELIEVES THAT WITH SNAPT PROJECT HAVE BEEN VIOLATED SOME COPYRIGHTS, PLEASE EMAIL US, AND ALL THE NECESSARY CHANGES WILL BE MADE. Pag. 10 Snap 1.0.0- Reference manual 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论