資源簡(jiǎn)介
C#與西門子S7-1200PLC通信
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?Sharp7;
namespace?Sharp7Example
{
????class?Program
????{
????????static?void?Main(string[]?args)
????????{
????????????//--------------?Create?and?connect?the?client
????????????var?client?=?new?S7Client();
????????????int?result?=?client.ConnectTo(“127.0.0.1“?0?1);
????????????if?(result?==?0)
????????????{
????????????????Console.WriteLine(“Connected?to?127.0.0.1“);
????????????}
????????????else
????????????{
????????????????Console.WriteLine(client.ErrorText(result));
????????????????Console.ReadKey();
????????????????return;
????????????}
????????????//--------------?Read?db1
????????????Console.WriteLine(“\n----?Read?DB?1“);
????????????byte[]?db1Buffer?=?ne
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????184??2017-02-19?22:07??Sharp7Example\App.config
?????文件???????5312??2017-02-19?22:07??Sharp7Example\Program.cs
?????文件???????1402??2017-02-19?22:07??Sharp7Example\Properties\AssemblyInfo.cs
?????文件???????2848??2017-02-19?22:07??Sharp7Example\Sharp7Example.csproj
?????文件???????1402??2017-02-19?22:07??Sharp7Library\Properties\AssemblyInfo.cs
?????文件?????131480??2017-02-19?22:07??Sharp7Library\Sharp7.cs
?????文件???????2409??2017-02-19?22:07??Sharp7Library\Sharp7Library.csproj
?????文件???????4195??2017-02-19?22:07??.gitignore
?????文件???????1075??2017-02-19?22:07??LICENSE
?????文件????????230??2017-02-19?22:07??README.md
?????文件???????1471??2017-02-19?22:07??Sharp7Example.sln
?????目錄??????????0??2018-01-05?22:57??Sharp7Example\Properties
?????目錄??????????0??2018-01-05?22:57??Sharp7Library\Properties
?????目錄??????????0??2018-01-05?22:57??Sharp7Example
?????目錄??????????0??2018-01-05?22:57??Sharp7Library
-----------?---------??----------?-----??----
???????????????152008????????????????????15
評(píng)論
共有 條評(píng)論