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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? form1.cs

?? CSharp開發的Windows下串口調試程序
?? CS
?? 第 1 頁 / 共 2 頁
字號:
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 申明要引用的和串口調用有關的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> 
		///串口的初始化函數 
		///lpFileName 端口名 
		///baudRate 波特率 
		///parity 校驗位 
		///byteSize 數據位 
		///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; 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久不卡影院| 欧美伦理影视网| 经典三级在线一区| 青青国产91久久久久久| 久久精品国产精品青草| 久久疯狂做爰流白浆xx| 国产一区二区三区四区五区入口 | 国产精品少妇自拍| 久久久另类综合| 国产精品视频麻豆| 最新不卡av在线| 亚洲一区二区三区四区不卡| 亚洲高清免费一级二级三级| 天堂蜜桃91精品| 精品一区二区三区av| 国产高清在线精品| 在线观看亚洲a| 日韩精品专区在线影院观看| 国产亚洲精久久久久久| 亚洲欧洲精品一区二区三区| 玉米视频成人免费看| 日韩三级免费观看| 日韩精品一级二级| 欧美日韩情趣电影| 亚洲成人资源在线| 欧美三区在线观看| 亚洲国产成人tv| 欧美日韩免费观看一区三区| 亚洲国产你懂的| 欧美性生活大片视频| 亚洲黄色av一区| 精品视频1区2区3区| 亚洲一区二区av电影| 欧美午夜精品久久久久久孕妇 | 午夜精品久久久久久久蜜桃app| 在线亚洲一区二区| 一区二区三区四区不卡在线| 在线国产电影不卡| 日韩精品国产欧美| 亚洲精品视频自拍| 91精品办公室少妇高潮对白| 夜夜精品视频一区二区| 欧美专区在线观看一区| 亚洲成人7777| 欧美日韩一级大片网址| 蜜臀a∨国产成人精品| 欧美成人三级在线| 高清久久久久久| 日韩毛片视频在线看| 欧洲一区在线电影| 亚洲v日本v欧美v久久精品| 欧美一级高清大全免费观看| 国产精一品亚洲二区在线视频| 久久精品一级爱片| 欧美中文字幕久久| 久久99国产精品久久99| 中文字幕人成不卡一区| 91免费观看在线| 男人的j进女人的j一区| 欧美激情一区二区三区不卡 | 国产偷国产偷精品高清尤物| 日韩精品每日更新| 欧美老肥妇做.爰bbww| 亚洲精品视频免费看| 国产成人丝袜美腿| 久久久久久黄色| 国产伦理精品不卡| 日韩一区二区精品葵司在线| 亚洲成人免费在线观看| 在线观看网站黄不卡| 亚洲欧美日本韩国| 91视频在线观看| 一区二区三区av电影| 色狠狠色狠狠综合| 一个色在线综合| 欧美怡红院视频| 亚洲地区一二三色| 欧美乱熟臀69xxxxxx| 日韩精品每日更新| 精品va天堂亚洲国产| 国内精品久久久久影院薰衣草| 精品国产一区二区三区不卡| 国内外精品视频| 国产日韩成人精品| www.av精品| 亚洲伦在线观看| 欧美视频在线观看一区二区| 五月激情综合色| 欧美电影精品一区二区| 国产成人精品网址| 亚洲黄一区二区三区| 91精品国产综合久久香蕉麻豆| 久久99精品国产麻豆婷婷| 国产欧美日韩中文久久| 91社区在线播放| 丝袜诱惑亚洲看片| 欧美成人猛片aaaaaaa| 福利电影一区二区三区| 亚洲色图欧美偷拍| 91麻豆精品91久久久久久清纯 | 国产成人精品三级| 亚洲伦在线观看| 日韩三级视频在线看| 成人av综合一区| 亚洲一区欧美一区| 久久久久9999亚洲精品| 在线亚洲高清视频| 国产成人免费在线观看| 亚洲线精品一区二区三区八戒| 337p亚洲精品色噜噜狠狠| 国产精品综合在线视频| 亚洲国产日韩a在线播放| 久久在线观看免费| 日本丰满少妇一区二区三区| 国产色91在线| av爱爱亚洲一区| 国产成人夜色高潮福利影视| 91浏览器在线视频| 美国十次综合导航| 亚洲欧美韩国综合色| 精品国产91九色蝌蚪| 欧美日韩一级黄| 色综合一个色综合亚洲| 韩国av一区二区| 男男视频亚洲欧美| 亚洲一区二区影院| 国产精品欧美久久久久一区二区| 欧美日韩综合在线| 一本色道a无线码一区v| 国产乱人伦偷精品视频不卡| 视频一区在线播放| 亚洲主播在线观看| 亚洲精品乱码久久久久久| 中文字幕va一区二区三区| 精品盗摄一区二区三区| 国产日韩欧美一区二区三区乱码| 欧美网站一区二区| 日本黄色一区二区| 91色综合久久久久婷婷| 成人短视频下载| 不卡在线视频中文字幕| 国产99一区视频免费| 国产乱码字幕精品高清av| 久久国产三级精品| 久草中文综合在线| 另类小说综合欧美亚洲| 青青草原综合久久大伊人精品优势| 亚洲国产精品一区二区久久| 亚洲黄色小说网站| 一二三四区精品视频| 亚洲国产精品影院| 日本不卡视频在线| 久久99久久99| 国产精品99久久久久久似苏梦涵| 国内精品在线播放| 国产精品原创巨作av| 国产成人av电影在线| 成人小视频在线| 99re视频这里只有精品| 在线观看网站黄不卡| 欧美日韩另类国产亚洲欧美一级| 欧美性猛交xxxx黑人交| 在线不卡a资源高清| 欧美日韩国产精选| 欧美一级日韩免费不卡| 2024国产精品| 自拍偷在线精品自拍偷无码专区| **性色生活片久久毛片| 亚洲综合在线免费观看| 日本不卡中文字幕| 懂色av中文一区二区三区| 成人精品国产福利| 在线精品视频一区二区| 日韩精品影音先锋| 18欧美亚洲精品| 日韩不卡一区二区三区| 国产一区 二区| 91久久久免费一区二区| 这里是久久伊人| 中文字幕巨乱亚洲| 亚瑟在线精品视频| 国产风韵犹存在线视精品| 欧美中文字幕一区二区三区亚洲| 欧美电影免费观看高清完整版在线观看 | 成a人片亚洲日本久久| 欧美视频在线观看一区二区| 久久久亚洲综合| 亚洲综合免费观看高清完整版在线 | 日本大胆欧美人术艺术动态| 国产成人在线色| 欧美精品国产精品| 亚洲国产成人在线| 日韩av一区二| 色吧成人激情小说| 久久久久久97三级| 性欧美大战久久久久久久久| 成人黄色在线看| 日韩一区二区三区视频在线观看| 中文字幕日韩精品一区| 精品一区免费av|