自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(2)
  • 资源 (4)
  • 收藏
  • 关注

原创 "未将对象引用设置到对象的实例"是什么原因?

<br /><br />            if (dataGridView1.Rows.Count != 0)<br />            {<br />                saveFileDialog1.Filter = "Execl files (*.xls)|*.xls";<br />                saveFileDialog1.FilterIndex = 0;<br />                saveFileDialog1.RestoreDirec

2011-02-01 17:09:00 2006

原创 C#中请问如何在串口通讯中接收输出HEX格式数据

小弟最近写了个C#串口通讯软件,目前链接串口已无问题,但是不知道如何接收和输出HEX数据以下是小弟的串口代码。。。using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO.Ports;u

2010-11-10 21:35:00 6861

UML课程设计告

面向对象分析与设计UML课程设计告,内容详细,欢迎下载

2011-12-18

serialport测试实现串口打开关闭及设置所有常用属性

串口链接,通过VS测试 public partial class Form1 : Form { public Form1() { InitializeComponent(); SerialNameSelect(); SelectPortStopBits(); SelectHandShake(); SelectParity(); SerialNumber.SelectedIndex = 0; serialBit.SelectedIndex = 2; SerialDataBits.SelectedIndex = 3; SerialStopBits.SelectedIndex = 1; SerialHandShoke.SelectedIndex = 1; SerialParity.SelectedIndex = 0; } private void SerialNameSelect() { string[] ports = SerialPort.GetPortNames(); foreach (string port in ports) { SerialNumber.Items.Add(port); } } private void SelectPortStopBits() { foreach (string s in Enum.GetNames(typeof(StopBits))) { SerialStopBits.Items.Add(s); } } private void SelectHandShake() { foreach (string s in Enum.GetNames(typeof(Handshake))) { SerialHandShoke.Items.Add(s); } } private void SelectParity() { foreach (string s in Enum.GetNames(typeof(Parity))) { SerialParity.Items.Add(s); } }。。。。。。。。。。

2011-01-22

通讯协议CRC16CCITT

通讯协议CRC16CCITT,通讯协议,CCITT,CRC16,CRC16CCITT

2010-08-13

C#串口通信,包括打开串口,接收发送数据

public partial class Form1 : Form { public Form1() { InitializeComponent(); } SerialPort port1 = new SerialPort(); string InputData = String.Empty; delegate void SetTextCallback(string text); private void Port_Select() {//获取机器中的串口地址 string[] ports = SerialPort.GetPortNames(); foreach (string port in ports) { comboBox1.Items.Add(port); } } private void Form1_Load_1(object sender, EventArgs e) { Port_Select(); this.comboBox1.SelectedIndex = 0; this.comboBox2.SelectedIndex = 0; } private void button1_Click(object sender, EventArgs e) { if (button1.Text == "关闭串口") //当要关闭串口的时候 { port1.DiscardOutBuffer(); port1.DiscardInBuffer(); port1.Close(); button1.Text = "打开串口"; label3.Text = "串口当前状况:未打开"; comboBox1.Enabled = true; comboBox2.Enabled = true; } else if (button1.Text == "打开串口") //当要打开串口的时候 { try { port1.PortName = comboBox1.SelectedItem.ToString(); port1.BaudRate = Convert.ToInt32(comboBox2.SelectedItem); port1.DataBits = 8; port1.RtsEnable = true; port1.Open(); port1.DiscardOutBuffer(); port1.DiscardInBuffer(); button1.Text = "关闭串口"; comboBox1.Enabled = false; comboBox2.Enabled = false; label3.Text = "串口:" + comboBox1.SelectedItem.ToString() + " 波特率:" + comboBox2.SelectedItem.ToString() + " 数据位:8 "; } catch { button1.Text = "打开串口"; label3.Text = "串口:" + comboBox1.SelectedItem.ToString() + "打开失败"; MessageBox.Show("该串口无法打开"); } } } 资源中部分代码

2010-08-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除