亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? form1.cs

?? c#,VB,vc,PC環(huán)境下的串口調(diào)試程序!
?? CS
?? 第 1 頁 / 共 2 頁
字號(hào):
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices; 
using System.Threading;

namespace SerialAPI 
{ 
	/// <summary> 
	/// SerialPort 的摘要說明。 
	/// </summary> 
	public class SerialPort 
	{ 
		#region 申明要引用的和串口調(diào)用有關(guān)的API 
		//win32 api constants 
		private const uint GENERIC_READ = 0x80000000; 
		private const uint GENERIC_WRITE = 0x40000000; 
		private const int OPEN_EXISTING = 3; 
		private const int INVALID_HANDLE_VALUE = -1; 
		private const int MAXBLOCK = 4096; 

		private const uint PURGE_TXABORT = 0x0001; // Kill the pending/current writes to the comm port. 
		private const uint PURGE_RXABORT = 0x0002; // Kill the pending/current reads to the comm port. 
		private const uint PURGE_TXCLEAR = 0x0004; // Kill the transmit queue if there. 
		private const uint PURGE_RXCLEAR = 0x0008; // Kill the typeahead buffer if there. 

		[StructLayout(LayoutKind.Sequential)] 
			private struct DCB 
		{ 
			//taken from c struct in platform sdk 
			public int DCBlength; // sizeof(DCB) 
			public int BaudRate; // current baud rate 
			public int fBinary; // binary mode, no EOF check 
			public int fParity; // enable parity checking 
			public int fOutxCtsFlow; // CTS output flow control 
			public int fOutxDsrFlow; // DSR output flow control 
			public int fDtrControl; // DTR flow control type 
			public int fDsrSensitivity; // DSR sensitivity 
			public int fTXContinueOnXoff; // XOFF continues Tx 
			public int fOutX; // XON/XOFF out flow control 
			public int fInX; // XON/XOFF in flow control 
			public int fErrorChar; // enable error replacement 
			public int fNull; // enable null stripping 
			public int fRtsControl; // RTS flow control 
			public int fAbortOnError; // abort on error 
			public int fDummy2; // reserved 
			public ushort wReserved; // not currently used 
			public ushort XonLim; // transmit XON threshold 
			public ushort XoffLim; // transmit XOFF threshold 
			public byte ByteSize; // number of bits/byte, 4-8 
			public byte Parity; // 0-4=no,odd,even,mark,space 
			public byte StopBits; // 0,1,2 = 1, 1.5, 2 
			public char XonChar; // Tx and Rx XON character 
			public char XoffChar; // Tx and Rx XOFF character 
			public char ErrorChar; // error replacement character 
			public char EofChar; // end of input character 
			public char EvtChar; // received event character 
			public ushort wReserved1; // reserved; do not use 
		} 

		[StructLayout(LayoutKind.Sequential)] 
			private struct COMMTIMEOUTS 
		{ 
			public int ReadIntervalTimeout; 
			public int ReadTotalTimeoutMultiplier; 
			public int ReadTotalTimeoutConstant; 
			public int WriteTotalTimeoutMultiplier; 
			public int WriteTotalTimeoutConstant; 
		} 

		[StructLayout(LayoutKind.Sequential)] 
			private struct OVERLAPPED 
		{ 
			public int Internal; 
			public int InternalHigh; 
			public int Offset; 
			public int OffsetHigh; 
			public int hEvent; 
		} 

		[StructLayout(LayoutKind.Sequential)] 
			private struct COMSTAT 
		{ 
			/*public int fCtsHold; 
			public int fDsrHold; 
			public int fRlsdHold; 
			public int fXoffHold; 
			public int fXoffSent; 
			public int fEof; 
			public int fTxim; 
			public int fReserved; 
			public int cbInQue; 
			public int cbOutQue;*/ 
			// Should have a reverse, i don't know why!!!!! 
			public int cbOutQue; 
			public int cbInQue; 
			public int fReserved; 
			public int fTxim; 
			public int fEof; 
			public int fXoffSent; 
			public int fXoffHold; 
			public int fRlsdHold; 
			public int fDsrHold; 
			public int fCtsHold; 
		} 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern int CreateFile( 
string lpFileName, // file name 
uint dwDesiredAccess, // access mode 
int dwShareMode, // share mode 
int lpSecurityAttributes, // SD 
int dwCreationDisposition, // how to create 
int dwFlagsAndAttributes, // file attributes 
int hTemplateFile // handle to template file 
); 
#else 
		[DllImport("coredll")] 
		private static extern int CreateFile( 
			string lpFileName, // file name 
			uint dwDesiredAccess, // access mode 
			int dwShareMode, // share mode 
			int lpSecurityAttributes, // SD 
			int dwCreationDisposition, // how to create 
			int dwFlagsAndAttributes, // file attributes 
			int hTemplateFile // handle to template file 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool GetCommState( 
int hFile, // handle to communications device 
ref DCB lpDCB // device-control block 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool GetCommState( 
			int hFile, // handle to communications device 
			ref DCB lpDCB // device-control block 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool BuildCommDCB( 
string lpDef, // device-control string 
ref DCB lpDCB // device-control block 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool BuildCommDCB( 
			string lpDef, // device-control string 
			ref DCB lpDCB // device-control block 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool SetCommState( 
int hFile, // handle to communications device 
ref DCB lpDCB // device-control block 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool SetCommState( 
			int hFile, // handle to communications device 
			ref DCB lpDCB // device-control block 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool GetCommTimeouts( 
int hFile, // handle to comm device 
ref COMMTIMEOUTS lpCommTimeouts // time-out values 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool GetCommTimeouts( 
			int hFile, // handle to comm device 
			ref COMMTIMEOUTS lpCommTimeouts // time-out values 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool SetCommTimeouts( 
int hFile, // handle to comm device 
ref COMMTIMEOUTS lpCommTimeouts // time-out values 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool SetCommTimeouts( 
			int hFile, // handle to comm device 
			ref COMMTIMEOUTS lpCommTimeouts // time-out values 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool ReadFile( 
int hFile, // handle to file 
byte[] lpBuffer, // data buffer 
int nNumberOfBytesToRead, // number of bytes to read 
ref int lpNumberOfBytesRead, // number of bytes read 
ref OVERLAPPED lpOverlapped // overlapped buffer 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool ReadFile( 
			int hFile, // handle to file 
			byte[] lpBuffer, // data buffer 
			int nNumberOfBytesToRead, // number of bytes to read 
			ref int lpNumberOfBytesRead, // number of bytes read 
			ref OVERLAPPED lpOverlapped // overlapped buffer 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool WriteFile( 
int hFile, // handle to file 
byte[] lpBuffer, // data buffer 
int nNumberOfBytesToWrite, // number of bytes to write 
ref int lpNumberOfBytesWritten, // number of bytes written 
ref OVERLAPPED lpOverlapped // overlapped buffer 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool WriteFile( 
			int hFile, // handle to file 
			byte[] lpBuffer, // data buffer 
			int nNumberOfBytesToWrite, // number of bytes to write 
			ref int lpNumberOfBytesWritten, // number of bytes written 
			ref OVERLAPPED lpOverlapped // overlapped buffer 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool CloseHandle( 
int hObject // handle to object 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool CloseHandle( 
			int hObject // handle to object 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool ClearCommError( 
int hFile, // handle to file 
ref int lpErrors, 
ref COMSTAT lpStat 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool ClearCommError( 
			int hFile, // handle to file 
			ref int lpErrors, 
			ref COMSTAT lpStat 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool PurgeComm( 
int hFile, // handle to file 
uint dwFlags 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool PurgeComm( 
			int hFile, // handle to file 
			uint dwFlags 
			); 
#endif 
#if FULLFRAMEWORK 
[DllImport("kernel32")] 
private static extern bool SetupComm( 
int hFile, 
int dwInQueue, 
int dwOutQueue 
); 
#else 
		[DllImport("coredll")] 
		private static extern bool SetupComm( 
			int hFile, 
			int dwInQueue, 
			int dwOutQueue 
			); 
#endif 
		#endregion 

		// SerialPort的成員變量 
		private int hComm = INVALID_HANDLE_VALUE; 
		private bool bOpened = false; 

		public bool Opened 
		{ 
			get 
			{ 
				return bOpened; 
			} 
		} 

		/// <summary> 
		///串口的初始化函數(shù) 
		///lpFileName 端口名 
		///baudRate 波特率 
		///parity 校驗(yàn)位 
		///byteSize 數(shù)據(jù)位 
		///stopBits 停止位 
		/// <summary> 
		public bool OpenPort(string lpFileName,int baudRate,byte parity, byte byteSize, byte stopBits) 
		{ 
			// OPEN THE COMM PORT. 
			hComm = CreateFile(lpFileName ,GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); 
			// IF THE PORT CANNOT BE OPENED, BAIL OUT. 
			if(hComm == INVALID_HANDLE_VALUE) 
			{ 
				return false; 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区中文字幕| 欧美天天综合网| 久久久久国产精品麻豆ai换脸| 日韩成人dvd| 精品99一区二区三区| 国产精品一区在线观看你懂的| 精品99一区二区三区| 国产在线视频不卡二| 国产亚洲欧美中文| 不卡一区二区在线| 亚洲一区二区三区在线看| 欧美精品v国产精品v日韩精品| 日本一区中文字幕 | 国产精品视频九色porn| 成人黄色片在线观看| 亚洲人成电影网站色mp4| 欧美日韩不卡一区| 日韩有码一区二区三区| 久久综合久久综合久久综合| 成人性视频免费网站| 有码一区二区三区| 日韩久久免费av| 成人av资源在线观看| 亚洲一区二区三区精品在线| 日韩一级免费一区| 成人a区在线观看| 日韩精品欧美成人高清一区二区| 欧美不卡在线视频| 色综合久久久久久久久久久| 日韩精品一二区| 中文av一区二区| 欧美情侣在线播放| 成人av动漫在线| 免费观看在线综合| 亚洲欧洲国产日本综合| 91精品国产91综合久久蜜臀| www.av亚洲| 免费观看成人鲁鲁鲁鲁鲁视频| 国产精品理伦片| 日韩欧美在线一区二区三区| 99精品1区2区| 国内精品伊人久久久久av一坑| 亚洲人成在线观看一区二区| 欧美大度的电影原声| 色婷婷av久久久久久久| 精品一区二区三区在线播放 | av成人动漫在线观看| 日韩精品一二三四| 亚洲精品高清视频在线观看| 久久欧美中文字幕| 6080亚洲精品一区二区| 色哟哟精品一区| 国产成人啪午夜精品网站男同| 午夜成人免费视频| 亚洲视频每日更新| 国产精品卡一卡二| 久久综合国产精品| 欧美一区二区福利在线| 欧美性受xxxx黑人xyx| www.66久久| 国产成人自拍网| 精品中文字幕一区二区小辣椒| 一区二区三区国产精品| 亚洲欧美怡红院| 国产亚洲精品超碰| 久久综合久久99| 精品剧情v国产在线观看在线| 欧美年轻男男videosbes| 在线观看一区二区视频| 99久久99久久精品免费看蜜桃| 国产精品一区二区视频| 美国av一区二区| 免费欧美在线视频| 国产风韵犹存在线视精品| 国模冰冰炮一区二区| 乱一区二区av| 麻豆成人在线观看| 精品一区二区三区免费视频| 美女任你摸久久| 美女精品一区二区| 久久9热精品视频| 视频一区二区不卡| 免费av网站大全久久| 日韩电影在线观看电影| 蜜桃在线一区二区三区| 久久精品免费观看| 国产呦萝稀缺另类资源| 国产精品自拍一区| 高清在线观看日韩| 99麻豆久久久国产精品免费 | 午夜在线电影亚洲一区| 亚洲国产人成综合网站| 肉肉av福利一精品导航| 久久国产综合精品| 国产精品一级片在线观看| 丁香激情综合国产| 色婷婷国产精品综合在线观看| 欧美亚洲动漫精品| 日韩欧美中文字幕精品| 国产亚洲一本大道中文在线| 国产精品久久久久久久蜜臀| 亚洲精品日日夜夜| 日本va欧美va瓶| 国产二区国产一区在线观看| 91蜜桃免费观看视频| 欧美精三区欧美精三区 | 欧美精品一区二区三区蜜桃| 久久女同性恋中文字幕| 亚洲精品日韩综合观看成人91| 午夜欧美在线一二页| 国产一区二区久久| 色av一区二区| 精品久久国产97色综合| 亚洲精品欧美在线| 韩日欧美一区二区三区| 色婷婷综合久久久中文一区二区 | 久久尤物电影视频在线观看| 在线观看日韩一区| 欧美一区二区三区爱爱| 26uuu国产日韩综合| 欧美国产精品一区| 亚洲天天做日日做天天谢日日欢| 视频在线观看一区二区三区| 蜜桃在线一区二区三区| 色综合视频在线观看| 欧美精品乱人伦久久久久久| 亚洲同性同志一二三专区| 日韩伦理av电影| 中文字幕中文字幕中文字幕亚洲无线| 视频一区欧美日韩| 国产高清不卡二三区| 色噜噜久久综合| 欧美成人一区二区三区在线观看| 久久一夜天堂av一区二区三区| 亚洲图片欧美色图| 精品一区二区三区香蕉蜜桃 | 17c精品麻豆一区二区免费| 午夜一区二区三区视频| 国产一区 二区| 欧美婷婷六月丁香综合色| 久久免费美女视频| 亚洲午夜激情av| 99久久伊人网影院| 91麻豆精品91久久久久久清纯| 日本一区免费视频| 三级久久三级久久久| 粉嫩在线一区二区三区视频| 精品久久久久香蕉网| 尤物视频一区二区| 精品在线观看免费| 51久久夜色精品国产麻豆| 一区二区三区中文字幕在线观看| 卡一卡二国产精品| 丁香婷婷综合色啪| 久久噜噜亚洲综合| 青青草一区二区三区| 日本精品免费观看高清观看| 久久久综合视频| 国产乱子伦视频一区二区三区| 欧美男人的天堂一二区| 自拍偷拍欧美激情| 国产精品一区二区在线观看网站 | 欧美经典一区二区| 免费在线观看一区| 久久影院视频免费| 亚洲国产精品精华液网站 | 久久久噜噜噜久久人人看 | 精品视频1区2区| 亚洲欧洲国产日韩| 99久久精品国产毛片| 久久久久99精品国产片| 免费观看91视频大全| 欧美在线观看禁18| 国产精品成人免费在线| 91影院在线免费观看| 国产精品网站一区| 国产福利不卡视频| 欧美一区二区三区性视频| 奇米四色…亚洲| 日韩三级伦理片妻子的秘密按摩| 亚洲高清免费视频| 欧美日韩一区在线| 美女任你摸久久| 欧美xfplay| 黄页网站大全一区二区| 欧美mv和日韩mv的网站| 国产精品一区二区不卡| 国产亚洲欧美中文| 福利电影一区二区三区| 国产精品久久免费看| 欧美亚洲一区三区| 亚洲v中文字幕| 欧美日韩一本到| 日本欧美在线观看| 欧美精品一区在线观看| 国产一区在线视频| 国产精品素人一区二区| 国产98色在线|日韩| 亚洲一区二区三区自拍| 欧美一卡二卡三卡|