• 大小: 1.60M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: PLC  数据  采集  

资源简介

可以用来与PLC通讯,采集PLC的数据

资源截图

代码片段和文件信息

using System;
using HslCommunication.Profinet.Siemens;
using HslCommunication;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace PLCRead
{
    class Program
    {
        static void Main(string[] args)
        {
            #region 连接PLC和数据库

            // 实例化对象,指定PLC的ip地址和端口号
            SiemensS7Net siemensTcpNet = new SiemensS7Net(SiemensPLCS.S1200 “192.168.23.11“);

            // 连接对象
            OperateResult connect = siemensTcpNet.ConnectServer();
            if (connect.IsSuccess)
                Console.WriteLine(“plc s7-1200 connect succeed:“);
            else
                Console.WriteLine(“connect failed:“ + connect.Message);

            // 服务器地址;端口号;数据库;用户名;密码
            string connectStr = “server=47.100.205.233;port=3306;database=stf

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-08-28 09:55  .vs\
     目录           0  2019-08-28 10:01  .vs\PLCRead\
     目录           0  2019-08-28 10:01  .vs\PLCRead\DesignTimeBuild\
     文件      413232  2019-08-28 10:01  .vs\PLCRead\DesignTimeBuild\.dtbcache
     目录           0  2019-08-28 09:55  .vs\PLCRead\v15\
     文件       35328  2019-08-28 10:01  .vs\PLCRead\v15\.suo
     目录           0  2019-08-28 09:55  .vs\PLCRead\v15\Server\
     目录           0  2019-08-28 09:55  .vs\PLCRead\v15\Server\sqlite3\
     文件           0  2019-06-01 16:07  .vs\PLCRead\v15\Server\sqlite3\db.lock
     文件      868352  2019-06-01 16:40  .vs\PLCRead\v15\Server\sqlite3\storage.ide
     文件       32768  2019-08-28 09:57  .vs\PLCRead\v15\Server\sqlite3\storage.ide-shm
     文件     4120032  2019-08-28 10:01  .vs\PLCRead\v15\Server\sqlite3\storage.ide-wal
     目录           0  2019-08-28 09:58  PLCRead\
     文件         481  2019-08-28 09:59  PLCRead\PLCRead.csproj
     文件        1320  2019-06-01 16:47  PLCRead\Program.cs
     文件       12334  2019-08-28 09:58  PLCRead\Storage.cs
     目录           0  2019-08-28 09:55  PLCRead\bin\
     目录           0  2019-08-28 09:55  PLCRead\bin\Debug\
     目录           0  2019-08-28 09:59  PLCRead\bin\Debug\netcoreapp2.1\
     文件      593408  2019-02-24 13:07  PLCRead\bin\Debug\netcoreapp2.1\HslCommunication.dll
     文件     1332736  2018-11-24 11:35  PLCRead\bin\Debug\netcoreapp2.1\HslCommunication.pdb
     文件      936318  2019-02-24 13:07  PLCRead\bin\Debug\netcoreapp2.1\HslCommunication.xml
     文件      487848  2019-02-24 13:07  PLCRead\bin\Debug\netcoreapp2.1\Newtonsoft.Json.dll
     文件      526562  2018-03-24 17:44  PLCRead\bin\Debug\netcoreapp2.1\Newtonsoft.Json.xml
     文件       10964  2019-08-28 09:59  PLCRead\bin\Debug\netcoreapp2.1\PLCRead.deps.json
     文件       11776  2019-08-28 09:59  PLCRead\bin\Debug\netcoreapp2.1\PLCRead.dll
     文件        2692  2019-08-28 09:59  PLCRead\bin\Debug\netcoreapp2.1\PLCRead.pdb
     文件         252  2019-08-28 09:59  PLCRead\bin\Debug\netcoreapp2.1\PLCRead.runtimeconfig.dev.json
     文件         154  2019-08-28 09:59  PLCRead\bin\Debug\netcoreapp2.1\PLCRead.runtimeconfig.json
     目录           0  2019-08-28 09:58  PLCRead\libs\
     文件      593408  2019-02-24 13:07  PLCRead\libs\HslCommunication.dll
............此处省略20个文件信息

评论

共有 条评论