资源简介

c#温度采集上位机程序

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ZedGraph;
using Microsoft.Win32;
//using System.Windows.Forms.Clipboard;
namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        //GraphPane myPane = zgc.GraphPane;
        byte[] buff = new byte[30];
        Boolean isopen=false;
        int counter = 0;
        PointPairList list = new PointPairList();

       // LineItem curve;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            try
            {


                if (isopen == false)
                {
                    serialPort1.BaudRate = Convert.ToInt32(comboBox2.Text);
                    serialPort1.PortName = comboBox1.Text;
                    serialPort1.Open();
                    serialPort1.Write(“s“);
                    if (Convert.ToUInt16(serialPort1.ReadLine()) != 1820)
                    {
                        MessageBox.Show(“没找到设备“);
                        return;
                    }
                    button1.Text = “停止采集“;

                    isopen = true;
                    serialPort1.Write(“i“);
                    label3.Text = “器件ID:“ + serialPort1.ReadLine();
                    serialPort1.Write(“j“);
                    switch (Convert.ToInt16(serialPort1.ReadLine()))
                    {
                        case 127:
                            label2.Text = “12位精度“;
                            break;
                        case 31:
                            label2.Text = “9位精度“;
                            break;
                        case 63:
                            label2.Text = “10位精度“;
                            break;
                        case 95:
                            label2.Text = “11位精度“;
                            break;
                        default:
                            label2.Text = “未知精度“;
                            break;


                    }
                    timer1.Interval = Convert.ToInt32(Convert.ToDouble(trackBar1.Value / 4) * 1000);
                    timer1.Start();
                }
                else
                {
                    timer1.Stop();
                    serialPort1.Close();
                    serialPort1.Dispose();
                    button1.Text = “开始采集“;
                    isopen = false;
                }
            }
            catch (System.TimeoutException)
            {
                MessageBox.Show(“没找到设备“);
                timer1.Stop();
                    serialPort1.Close();
                    serialPort1.Dispose();
                    button1.Text = “开始采集“;
                    isopen = false;

            }
            catch (Exception ex)
        

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

     文件       5830  2008-02-08 13:29  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\ds18b20C版.csproj

     文件        535  2008-02-07 00:37  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\ds18b20C版.csproj.user

     文件       1708  2008-02-07 00:17  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\ds18b20C版_TemporaryKey.pfx

     文件       9060  2008-02-08 16:38  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Form1.cs

     文件      22351  2008-02-08 16:38  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Form1.Designer.cs

     文件       6585  2008-02-08 16:38  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Form1.resx

     文件        478  2008-02-06 23:45  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Program.cs

     文件       1208  2008-02-07 00:14  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Properties\AssemblyInfo.cs

     文件        589  2008-02-08 13:29  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Properties\DataSources\ZedGraph.Line.datasource

     文件       2894  2008-02-06 12:56  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Properties\Resources.Designer.cs

     文件       5612  2008-02-06 12:56  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Properties\Resources.resx

     文件       1104  2008-02-06 12:56  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Properties\Settings.Designer.cs

     文件        249  2008-02-06 12:56  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\Properties\Settings.settings

     文件      99678  2008-02-06 20:05  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版\sync.ico

     文件        922  2008-02-06 13:20  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版.sln

    ..A..H.     34304  2008-02-08 16:39  5.C#编写的温度采集上位机程序\ds18b20C版\Backup\ds18b20C版.v11.suo

     文件        117  2017-01-01 14:46  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\app.config

     文件      32768  2008-02-06 13:01  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\AxInterop.Mathworks_LEDLibCtl.dll

     文件       1639  2017-01-01 21:45  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.application

     文件     120832  2017-01-01 21:45  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.exe

     文件        117  2017-01-01 14:46  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.exe.config

     文件       4769  2017-01-01 21:45  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.exe.manifest

     文件      38400  2017-01-01 21:45  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.pdb

     文件       5120  2008-02-06 15:20  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.publish\ds18b20C版_1_0_0_0\AxInterop.Microsoft_VisualStudio_OfficeTools_UnmanagedWrapper.dll.deploy

     文件      45056  2008-02-06 16:05  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.publish\ds18b20C版_1_0_0_0\AxInterop.MSDataGridLib.dll.deploy

     文件     126976  2008-02-07 00:14  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.publish\ds18b20C版_1_0_0_0\ds18b20C版.exe.deploy

     文件       6656  2008-02-06 15:58  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.publish\ds18b20C版_1_0_0_0\Interop.Microsoft_VisualStudio_OfficeTools_UnmanagedWrapper.dll.deploy

     文件      15360  2008-02-06 13:20  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.publish\ds18b20C版_1_0_0_0\Interop.MSCommLib.dll.deploy

     文件      65536  2008-02-06 16:05  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.publish\ds18b20C版_1_0_0_0\Interop.MSDataGridLib.dll.deploy

     文件      99678  2008-02-06 20:05  5.C#编写的温度采集上位机程序\ds18b20C版\ds18b20C版\bin\Debug\ds18b20C版.publish\ds18b20C版_1_0_0_0\sync.ico.deploy

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

评论

共有 条评论