• 大小: 27.52MB
    文件类型: .rar
    金币: 2
    下载: 2 次
    发布日期: 2023-06-22
  • 语言: C#
  • 标签: 串口通讯  

资源简介

C#与基恩士系列PLC通信,适用于所有基恩士系列,附带通信协议,FX系列通信协议,FX系列PLC与PC通信,代码有注释。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.Threading;
using System.IO.Ports;
using System.Data.OleDb;
using System.Data.SqlClient;

namespace TSCLIB_DLL_IN_C_Sharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        
        string path_6110001 = “d:\\测试照片\\6110001\\“;   //6110001最终照片存储位置
        string path_6110002 = “d:\\测试照片\\6110002\\“;   //6110002最终照片存储位置
        string path_6110003 = “d:\\测试照片\\6110003\\“;   //6110003最终照片存储位置
        string path_6112001 = “d:\\测试照片\\6112001\\“;   //6112001最终照片存储位置
        //string path_bmp = “d:\\linshi“;  //读取AOI临时存放图片的文件夹“D:\keyence\ok\192.168.1.30\SD2\cv-x\image\SD1_001“;
        //string path_bmp = “D:\\临时照片存储\\192.168.1.30\\SD2\\cv-x\\image\\SD1_001\\CAM1“;
        string path_bmp;
        string datapath = “d:\\参数\\datainf_ap13.txt“;
        string monthpath = “d:\\参数\\monthinf_ap13.txt“;
        string serialnum = “d:\\参数\\serialnuminf_ap13.txt“;
        string search_path;  //追溯时候的查询路径,软件判断
        string code;
        string date;   //定义日期
        string styear;
        string stmonth;
        int serial_6110001;
        int serial_6110002;
        int serial_6110003;
        int serial_6112001;
        // Int64 serial_date;  //定义标签内容的数字量格式
        int year;
        int month;
        int day;
        int minute;
        int second;
        float count_files_exist; //临时存储照片文件夹的文件数量
        Int16 day_load;
            
        Int16 serial_6110001_load;
        Int16 serial_6110002_load;
        Int16 serial_6110003_load;
        Int16 serial_6112001_load;
        Int16 month_load;
        bool Flag_bmpexist; //临时照片存在标志位
        bool Flag_seasrchcode_err;
        char[] target_serachcode;
        public char[] recBuf = new char[5];
        public bool recFlg = false;
        public char[] arr = new char[5];
        public char[] send = new char[6];
        byte a;//定义FOR循环的变量
        bool Flag_Focus_on;
        public void creattxt()
        {
            if (!File.Exists(datapath))
            {
                File.Create(datapath);
            }
            if (!File.Exists(serialnum))
            {
                File.Create(serialnum);
            }
            if (!File.Exists(monthpath))
            {
                File.Create(monthpath);
            }
            
        }

        public void loadparainf()
        {
            FileInfo fi = new FileInfo(datapath);
            if (fi.Length > 0)
            {
                try
                {
                    StreamReader sr = fi.OpenText();
                    day_load = Convert.ToInt16(sr.ReadLine());
                    sr.Close();
                }
                catch (Exception ex)
                {
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      45825  2014-09-16 08:46  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\Form1.cs

     文件       9567  2014-08-27 14:21  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\Form1.Designer.cs

     文件       6208  2014-08-27 14:21  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\Form1.resx

     文件       2520  2008-04-16 09:09  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\Program.cs

     文件       1217  2008-04-16 08:38  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\Properties\AssemblyInfo.cs

     文件       2866  2013-06-24 11:46  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\Properties\Resources.Designer.cs

     文件       5612  2008-04-16 08:38  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\Properties\Resources.resx

     文件       1119  2013-06-24 11:46  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\Properties\Settings.Designer.cs

     文件        249  2008-04-16 08:38  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\Properties\Settings.settings

     文件       3457  2013-06-24 11:46  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp\TSCLIB_DLL_IN_C_Sharp.csproj

     文件        953  2013-06-24 11:47  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp.sln

    ..A..H.     25600  2014-09-30 11:04  基恩士PLC通讯\C# 与基恩士PLC 通信\Backup\TSCLIB_DLL_IN_C_Sharp.suo

     文件        144  2014-10-07 10:34  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\app.config

     文件      16958  2016-01-20 21:51  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Debug\favicon-20160120094737890.ico

     文件     360800  2013-01-23 07:54  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Debug\Microsoft.SqlServer.BatchParser.dll

     文件     980480  2016-09-25 10:44  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Debug\TSCLIB_DLL_IN_C_Sharp.exe

     文件        144  2014-10-07 10:34  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Debug\TSCLIB_DLL_IN_C_Sharp.exe.config

     文件      95744  2016-09-25 10:44  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Debug\TSCLIB_DLL_IN_C_Sharp.pdb

     文件      11592  2017-07-28 10:20  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Debug\TSCLIB_DLL_IN_C_Sharp.vshost.exe

     文件        144  2014-10-07 10:34  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Debug\TSCLIB_DLL_IN_C_Sharp.vshost.exe.config

     文件        490  2012-06-06 02:06  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Debug\TSCLIB_DLL_IN_C_Sharp.vshost.exe.manifest

     文件      26709  2015-07-02 23:24  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Debug\甬标1.jpg

     文件     360800  2013-01-23 07:54  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Release\Microsoft.SqlServer.BatchParser.dll

     文件      94208  2018-08-23 00:28  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Release\TSCLIB.dll

     文件      15872  2013-08-08 08:04  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Release\TSCLIB_DLL_IN_C_Sharp.exe

     文件      30208  2013-08-08 08:04  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Release\TSCLIB_DLL_IN_C_Sharp.pdb

     文件      14328  2013-08-08 08:04  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Release\TSCLIB_DLL_IN_C_Sharp.vshost.exe

     文件        490  2007-07-21 02:33  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\bin\Release\TSCLIB_DLL_IN_C_Sharp.vshost.exe.manifest

     文件      72997  2017-07-26 09:04  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\Form1.cs

     文件       7460  2016-09-25 10:44  基恩士PLC通讯\C# 与基恩士PLC 通信\TSCLIB_DLL_IN_C_Sharp\Form1.Designer.cs

............此处省略75个文件信息

评论

共有 条评论