设为首页 加入收藏 网站首页
休闲娱乐
军事·社会百态·娱乐八卦·校园
体育·美女写真·幽默笑话·游戏
综合·在线视频·搞笑图片·灵异
两性生活
两性知识·性爱技巧
情色实录·两性图片
女性健康·同性之恋
电脑网络
网络编程·网页制作·软件教学
操作系统·图形图象·冲浪宝典
网络安全·邮件系统·认证考试
热点专题
芙蓉·真人漫画
72式·欲望都市
帅哥·人体彩绘
您现在的位置: 世纪中国 >> 网络编程 >> C#CSHARP教学 >> c#应用 >> 教程正文
C#结合串口通信类实现串口通信源代码
作者:中国图霸    教程来源:网络    点击数:    更新时间:2007-1-1

mycom是串口通信类,在本blog前一篇中有完整代码。
下面是串口通讯测试程序的源代码,将mycom类放在此项目中
可以实现简单的串口通信,希望读者能通过这个程序对串口通信过程有一个初步的了解:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
namespace BusApp
{
 /// <summary>
 /// Form1 的摘要说明。
 /// </summary>
 public class Form1 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.GroupBox groupBox1;
  private System.Windows.Forms.Label label3;
  private System.Windows.Forms.Label label4;
  private System.Windows.Forms.Label label5;
  private System.Windows.Forms.Label label6;
  private System.Windows.Forms.Button button2;
  private System.Windows.Forms.Button button3;
  private System.Windows.Forms.Button button4;
  private System.Windows.Forms.TextBox textBox8;
  private System.Windows.Forms.Label label7;

  public int iPort=1; //1,2,3,4
  public int iRate=9600; //1200,2400,4800,9600
  public byte bSize=8; //8 bits
  public byte bParity=0; // 0-4=no,odd,even,mark,space
  public byte bStopBits=1; // 0,1,2 = 1, 1.5, 2
  public int iTimeout=1000;
  public mycom mycom1=new mycom();
  public byte[] recb;

  private System.Windows.Forms.TextBox msg;
  private System.Windows.Forms.TextBox t_port;
  private System.Windows.Forms.TextBox t_rate;
  private System.Windows.Forms.TextBox t_bytesize;

[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

分类推荐
社会 社会 娱乐 军事 校园
幽默 体育 女性 专题
电脑 编程 网页 软件 系统
安全 图象 冲浪 认证
搞笑 人物 动物 物品 表情
签名 色图 漫画 奇闻
美女 明星 清纯 自拍 欧美
丝袜 卡通 性感 走光
两性 知识 性图 孕育 技巧
同性 单身 情感 实录
视频 写真 搞笑 MTV 翻唱
写实 片段 游戏 综艺
c#应用热门文章
普通教程 C#操作Word文档(Office 2007)
普通教程 对C#委托及事件委托的理解
普通教程 C# GridView 排序及分页
普通教程 关于C#中的DLLImport
普通教程 再现C#导出Excel源码
普通教程 C#结合串口通信类实现串口通信
普通教程 对C#下函数,委托,事件的一点
普通教程 C# 操作文件
普通教程 C#使用WIN32API来遍历文件和目
普通教程 C# Enum设计和使用的相关技巧
普通教程 C#实现类似qq的屏幕截图程序
普通教程 C#的Windows编程中多语言的实现
普通教程 C#中的抽象类
普通教程 Visual C#创建和使用ActiveX组
普通教程 用C#访问ACCESS数据库问题
普通教程 c#远程获取网页内容
普通教程 C#一个象棋游戏程序
普通教程 用C#动态创建Access数据库
普通教程 在C#中使用热键隐含窗口
普通教程 用C#把文件转换为XML

  广东广州海珠区 世纪网络工作室 版权所有 上海电信提供网络带宽
信箱: 9297659@qq.com 粤ICP备06113754号