资源简介
通过串口接收数据,同时可以将所接收到的数据以Excel表格保存起来的简单界面操作
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO.Ports;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int serial = 0;
SerialPort sp = null;
bool isOpen = false;
bool isSetProperty = false;
bool ishex = false;
bool rdeviceaddrflag = false;
bool rsjdeviceaddrflag = false;
bool wdeviceaddrflag = false;
bool wsjdeviceaddrflag = false;
bool passwordflag = false;
bool updateflag = false;
int rdeviceaddrtime = 0;
int rsjdeviceaddrtime = 0;
int times = 0;
int length;
int sendtimes = 0;
//创建临时数组 for:test 2017-2-28
// Byte[] ReceivedtemperData = new Byte[100];
int [] ReceivedtemperData = new int [100];
static int receivelength = 0;
string receive = null;
//2017-7-8
int[] deviceaddrsend = new int[5];
int[] sjdeviceaddrsend = new int[5];
int[] password = new int[6];
int[] dopassword = new int[6];
static int ooldpass;
int ooldpass1;
int ooldpass2;
int ooldpass3;
int ooldpass4;
static int nnewpass;
int nnewpass1;
int nnewpass2;
int nnewpass3;
int nnewpass4;
int date;
static int dopass;
int dopass1;
int dopass2;
int dopass3;
int dopass4;
// Thread t = new Thread(DoWork);
// add 2017-3-1
//int [] Receivebuff=new int [50];
// int [] GPSdata=new int [50];
public static int[] Receivebuff;
public static int[] GPSdata;
public static int[] GPIMUdata;
public static int[] GPFPDdata;
//
// string[] GPS=new string[]{“$GPGLL“};
//
// [DllImport(“ControlCAN.dll“)]
// static extern UInt32 VCI_OpenDevice(UInt32 DeviceType UInt32 Deviceind UInt32 Reserved);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender EventArgs e)
{
this.MaximumSize = this.Size;
this.MinimumSize = this.Size;
this.MaximizeBox = false;
for (int i = 0; i < 10; i++)
{
cbxCOMPort.Items.Add(“COM“+(i+1).ToString());
}
cbxCOMPort.SelectedIndex = 0;
//波特率
comboBox_baud.Items.Add(“1200“);
comboBox_baud.Items.Add(“2400“);
comboBox_baud.Items.Add(“4800“);
comboBox_baud.Items.Add(“9600“);
comboBox_baud.It
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-09-12 17:40 抄表界面\
目录 0 2017-09-12 17:41 抄表界面\WindowsFormsApplication1\
文件 962 2017-02-23 09:18 抄表界面\WindowsFormsApplication1.sln
文件 57856 2018-02-01 16:13 抄表界面\WindowsFormsApplication1.v11.suo
文件 187 2017-02-23 09:18 抄表界面\WindowsFormsApplication1\App.config
目录 0 2017-09-12 17:41 抄表界面\WindowsFormsApplication1\bin\
目录 0 2017-09-13 20:36 抄表界面\WindowsFormsApplication1\bin\Debug\
文件 33280 2018-02-01 16:13 抄表界面\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
文件 187 2017-02-23 09:18 抄表界面\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
文件 71168 2018-02-01 16:13 抄表界面\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
文件 22984 2018-02-01 16:13 抄表界面\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
文件 187 2017-02-23 09:18 抄表界面\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
文件 490 2015-06-04 12:48 抄表界面\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
目录 0 2017-09-12 17:41 抄表界面\WindowsFormsApplication1\bin\Release\
文件 47184 2017-09-12 17:54 抄表界面\WindowsFormsApplication1\Form1.cs
文件 35248 2017-07-08 19:17 抄表界面\WindowsFormsApplication1\Form1.Designer.cs
文件 5817 2017-07-08 19:17 抄表界面\WindowsFormsApplication1\Form1.resx
目录 0 2017-09-12 17:40 抄表界面\WindowsFormsApplication1\obj\
目录 0 2018-02-01 16:13 抄表界面\WindowsFormsApplication1\obj\Debug\
文件 1308 2017-02-28 09:31 抄表界面\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7019 2017-09-12 17:41 抄表界面\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2017-02-23 09:18 抄表界面\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2017-02-23 09:18 抄表界面\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2017-02-23 09:18 抄表界面\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
目录 0 2017-02-23 09:18 抄表界面\WindowsFormsApplication1\obj\Debug\TempPE\
文件 11070 2018-02-01 16:13 抄表界面\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
文件 975 2017-07-08 19:17 抄表界面\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache
文件 2209 2017-02-23 09:21 抄表界面\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csprojResolveAssemblyReference.cache
文件 33280 2018-02-01 16:13 抄表界面\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.exe
文件 180 2017-09-12 17:54 抄表界面\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Form1.resources
文件 71168 2018-02-01 16:13 抄表界面\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.pdb
............此处省略9个文件信息
- 上一篇:档案管理系统 C# 源码
- 下一篇:扫雷游戏_C# 源码
评论
共有 条评论