c#
酱油p
这个作者很懒,什么都没留下…
展开
-
justinIO的源代码
namespace JustinIO { class CommPort { public int PortNum=Form1.pn; public int BaudRate=9600; public byte ByteSize=8; public byte Parity=0; // 0-4=no,odd,eve转载 2013-04-01 09:33:40 · 451 阅读 · 0 评论 -
C# DllImport用法和路径问题
DllImport是System.Runtime.InteropServices命名空间下的一个属性类,其功能是提供从非托管DLL导出的函数的必要调用信息。 DllImport属性应用于方法,要求最少要提供包含入口点的dll的名称。 DllImport的定义如下: [AttributeUsage(AttributeTargets.Method)]转载 2013-05-13 10:06:31 · 430 阅读 · 0 评论 -
C# Thread类
http://developer.51cto.com/art/200908/141590.htm 一、C# Thread类的基本用法通过System.Threading.Thread类可以开始新的线程,并在线程堆栈中运行静态或实例方法。可以通过Thread类的的构造方法传递一个无参数,并且不返回值(返回void)的委托(ThreadStart),这个委托的定义如下:[ComV转载 2013-04-08 21:51:04 · 445 阅读 · 0 评论 -
MSComm控件在串口编程中使用
摘要:本文详细介绍了MSComm控件在串口编程中使用。 MSComm控件两种处理通讯的方式CommPort属性RThreshold 属性CTSHolding 属性SThreshold 属性CDHolding 属性DSRHolding 属性Settings 属性InputLen 属性EOFEnable 属性Handshake 常数OnCo转载 2013-04-08 16:26:23 · 420 阅读 · 0 评论 -
使用serialPort读取GPS数据
using System;using System.IO.Ports;using System.Collections;using System.Collections.Generic;using System.Windows.Forms;using System.Runtime.InteropServices;namespace Lordeo.AssetMan.PPC.App{转载 2013-03-25 16:09:43 · 459 阅读 · 0 评论 -
使用 SerialPort 类在两台通过 NULL 调制解调器电缆连接的独立计算机上聊天
using System;using System.IO.Ports;using System.Threading;public class PortChat{ static bool _continue; static SerialPort _serialPort; public static void Main() {转载 2013-03-25 10:36:15 · 451 阅读 · 0 评论 -
FileStream打开TXT并加入数据
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace Filestream{ /// /// 从流中读,向流中写 /// class Program {原创 2013-03-22 21:04:26 · 408 阅读 · 0 评论 -
try-catch-finally
try { //执行的代码,其中可能有异常。一旦发现异常,则立即跳到catch执行。否则不会执行catch里面的内容 } catch { //除非try里面执行代码发生了异常,否则这里的代码不会执行 } finally { //不管什么情况都会执行,包括try catch 里面用了return ,可以理解为只要执行了try或者catch,就一定会执行 fin原创 2013-03-23 15:34:59 · 478 阅读 · 0 评论 -
Win32串口API
在工业控制中,工控机(一般都基于Windows平台)经常需要与智能仪表通过串口进行通信。串口通信方便易行,应用广泛。 一般情况下,工控机和各智能仪表通过RS485总线进行通信。RS485的通信方式是半双工的,只能由作为主节点的工控PC机依次轮询网络上的各智能控制单元子节点。每次通信都是由PC机通过串口向智能控制单元发布命令,智能控制单元在接收到正确的命令后作出应答。 在Win32下,可以使转载 2013-04-02 19:41:58 · 305 阅读 · 0 评论 -
在C#中实现串口通信的常用方法
本文主要是讲述如何通过C# .net1.1平台调用API操作串口,.net2.0已经内置串口操作类! 通常,在C#中实现串口通信,我们有四种方法: 第一:通过MSCOMM控件这是最简单的,最方便的方法。可功能上很难做到控制自如,同时这个控件并不是系统本身所带,所以还得注册。可以访问http://www.devhood.com/tutorials/tutorial_detai转载 2013-03-31 20:27:26 · 519 阅读 · 0 评论 -
用c#读取GPS数据并处理
using System; using System.Runtime.InteropServices; using System.Text; namespace BaseStationPDA { class GPS { public string PortNum; public int BaudRate; public byte B转载 2013-03-31 19:47:48 · 1040 阅读 · 0 评论 -
c#静态方法和实例方法的几种用法
c#静态方法和实例方法的几种用法 见如下代码:这三种形式我们应该都用过。?1234567891011121314151617181920212223public class SomeClass{ private string myfi转载 2013-03-21 10:52:51 · 608 阅读 · 0 评论