资源简介
是一款温度采集上位机程序源码,可作为开发人员的案例

代码片段和文件信息
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)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-06-10 13:30 ds18b20C
----------- --------- ---------- ----- ----
2118395 107
- 上一篇:C#版银海社保系统连接
- 下一篇:WinForm窗体及其控件的自适应
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
评论
共有 条评论