三菱PLC通讯RS485模块数据采集与C#开发监控软件到Excel

using ActUtlTypeLib;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.Streaming;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace 台博数据采集
{

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        void jieShouID(string str)//方法=接收子窗体的委托
        {
            sid = str;
            //textBox1.Text = str;
            sid2 = sid;
        }

        public string[] plcDword ={"D500","D501","D502","D503","D504","D505","D506","D507","D508","D509","D510",
            "D511","D512","D513","D514","D515","D516","D517"
        };

        //淋膜模头2#温度的寄存器地址
        public string[] plcDword2 = { "D600","D601","D602","D603","D604","D605","D606","D607","D608","D609","D610",
            "D611","D612","D613","D614","D615","D616","D617"
        };

        //淋膜环境的寄存器地址
        public string[] plcDword3 = { "D700","D701","D702","D703","D704","D705","D706","D707","D708","D709","D710","D711",
            "D716","D718","D719"

            };

        //涂布烘箱温度的寄存器地址
        public string[] plcDword4 = { "D110","D120","D130","D140","D150","D160","D170",
                "D210","D220","D230","D240","D250","D260","D270",
                "D310","D320","D330","D340","D350","D360","D370",
            };

        //涂布环境温度的寄存器地址
        public string[] plcDword5 = { "D180", "D410", "D420", "D430", "D440", "D450", "D460", "D470", "D480",
            "D103","D102","D700","D701","D702","D703",

            };

        public int XunHuan = 0;//开始通讯按钮,循环读取开始标志
        public int Open1 = 0;//1站在线标志
        public int Open2 = 0;//2站在线标志
        public int RunStop = 0;//开始通讯按钮=1,关闭通讯按钮=0。
        public int add1 = 0;//写入Excel文件的当前行号
        public int add2 = 0;//写入文件执行标志
        public string sid;//创建文件夹的位置
        public static string sid2;//保存创建文件夹的位置

        public string[] fanHui = new string[18] { "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" };//淋膜1#当前温度
        public string[] fanHui2 = new string[18] { "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" };//淋膜2#当前温度
        public string[] fanHui3 = new string[15] { "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" };//淋膜环境温度
        public string[] fanHui4 = new string[21] { "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" };//涂布烘箱温度
        public string[] fanHui5 = new string[15] { "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" };//涂布环境温度

        #region//创建文件的按钮处理
        /// 
        /// 创建文件的按钮处理
        /// 
        /// 
        /// 
        private void 创建文件夹ToolStripMenuItem_Click(object sender, EventArgs e)//创建文件夹按钮
        {
            Form2 form2 = new Form2(jieShouID);
           

你可能感兴趣的:(PLC与C#,c#)