91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 28.24MB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-04
  • 語言: C/C++
  • 標簽:

資源簡介

很簡單實用的16進制串口通信demo,還帶非常實用的虛擬串口和串口監視工具

資源截圖

代碼片段和文件信息

/*
** FILENAME CSerialPort.cpp
**
** PURPOSE This?class?can?read?write?and?watch?one?serial?port.
** It?sends?messages?to?its?owner?when?something?happends?on?the?port
** The?class?creates?a?thread?for?reading?and?writing?so?the?main
** program?is?not?blocked.
**
** CREATION?DATE 15-09-1997
** LAST?MODIFICATION 12-11-1997
**
** AUTHOR Remon?Spekreijse
**
**??2007-12-25?mrlong????https://code.google.com/p/mycom/
**??2011-11-06?liquanhai?http://blog.csdn.net/liquanhai/article/details/6941574
**??2013-12-04?viruscamp
**??2014-01-10?itas??????http://blog.csdn.net/itas109
**??2014-12-18?liquanhai?http://blog.csdn.net/liquanhai/article/details/6941574
*/

#include?“stdafx.h“
#include?“SerialPort.h“

#include?

int?m_nComArray[20];
//
//?Constructor
//
CSerialPort::CSerialPort()
{
m_hComm?=?NULL;

//?initialize?overlapped?structure?members?to?zero
///初始化異步結構體
m_ov.Offset?=?0;
m_ov.OffsetHigh?=?0;

//?create?events
m_ov.hEvent?=?NULL;
m_hWriteEvent?=?NULL;
m_hShutdownEvent?=?NULL;

m_szWriteBuffer?=?NULL;

m_bThreadAlive?=?FALSE;
m_nWriteSize?=?1;
m_bIsSuspened?=?FALSE;
}

//
//?Delete?dynamic?memory
//
CSerialPort::~CSerialPort()
{
do
{
SetEvent(m_hShutdownEvent);
}?while?(m_bThreadAlive);

//?if?the?port?is?still?opened:?close?it?
if?(m_hComm?!=?NULL)
{
CloseHandle(m_hComm);
m_hComm?=?NULL;
}
//?Close?Handles??
if(m_hShutdownEvent!=NULL)
CloseHandle(?m_hShutdownEvent);?
if(m_ov.hEvent!=NULL)
CloseHandle(?m_ov.hEvent?);?
if(m_hWriteEvent!=NULL)
CloseHandle(?m_hWriteEvent?);?

//TRACE(“Thread?ended\n“);

delete?[]?m_szWriteBuffer;
}

//
//?Initialize?the?port.?This?can?be?port?1?to?MaxSerialPortNum.
///初始化串口。只能是1-MaxSerialPortNum
//
//parity:
//??n=none
//??e=even
//??o=odd
//??m=mark
//??s=space
//data:
//??5678
//stop:
//??11.52?
//
BOOL?CSerialPort::InitPort(HWND?pPortOwner //?the?owner?(CWnd)?of?the?port?(receives?message)
???UINT??portnr //?portnumber?(1..MaxSerialPortNum)
???UINT??baud //?baudrate
???char??parity //?parity?
???UINT??databits //?databits?
???UINT??stopbits //?stopbits?
???DWORD?dwCommEvents //?EV_RXCHAR?EV_CTS?etc
???UINT??writebuffersize//?size?to?the?writebuffer
???
???DWORD???ReadIntervalTimeout
???DWORD???ReadTotalTimeoutMultiplier
???DWORD???ReadTotalTimeoutConstant
???DWORD???WriteTotalTimeoutMultiplier
???DWORD???WriteTotalTimeoutConstant?)

{
assert(portnr?>?0?&&?portnr? assert(pPortOwner?!=?NULL);

//?if?the?thread?is?alive:?Kill
if?(m_bThreadAlive)
{
do
{
SetEvent(m_hShutdownEvent);
}?while?(m_bThreadAlive);
//TRACE(“Thread?ended\n“);
}

//?create?events
if?(m_ov.hEvent?!=?NULL)
ResetEvent(m_ov.hEvent);
else
m_ov.hEvent?=?CreateEvent(NULL?TRUE?FALSE?NULL);

if?(m_hWriteEvent?!=?NULL)
ResetEvent(m_hWriteEvent);
else
m_hWriteEvent?=?CreateEvent(NULL?TRUE?FALSE?NULL);

if?(m_hShutdownEvent?!=?NULL)
ResetEven

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????170496??2017-07-16?22:19??test2\Debug\test2.exe

?????文件????1178324??2017-07-16?22:19??test2\Debug\test2.ilk

?????文件????5049344??2017-07-16?22:19??test2\Debug\test2.pdb

?????文件???????2738??2017-07-16?22:19??test2\test2\Debug\cl.command.1.tlog

?????文件??????49048??2017-07-16?22:19??test2\test2\Debug\CL.read.1.tlog

?????文件???????1930??2017-07-16?22:19??test2\test2\Debug\CL.write.1.tlog

?????文件??????????2??2017-07-16?22:19??test2\test2\Debug\link-cvtres.read.1.tlog

?????文件??????????2??2017-07-16?22:19??test2\test2\Debug\link-cvtres.write.1.tlog

?????文件??????????2??2017-07-16?22:19??test2\test2\Debug\link.8092-cvtres.read.1.tlog

?????文件??????????2??2017-07-16?22:19??test2\test2\Debug\link.8092-cvtres.write.1.tlog

?????文件??????????2??2017-07-16?22:19??test2\test2\Debug\link.8092.read.1.tlog

?????文件??????????2??2017-07-16?22:19??test2\test2\Debug\link.8092.write.1.tlog

?????文件???????1596??2017-07-16?22:19??test2\test2\Debug\link.command.1.tlog

?????文件???????4630??2017-07-16?22:19??test2\test2\Debug\link.read.1.tlog

?????文件????????978??2017-07-16?22:19??test2\test2\Debug\link.write.1.tlog

?????文件????????540??2017-07-16?22:19??test2\test2\Debug\mt.command.1.tlog

?????文件????????456??2017-07-16?22:19??test2\test2\Debug\mt.read.1.tlog

?????文件????????358??2017-07-16?22:19??test2\test2\Debug\mt.write.1.tlog

?????文件????????916??2017-07-16?22:17??test2\test2\Debug\rc.command.1.tlog

?????文件???????2990??2017-07-16?22:17??test2\test2\Debug\rc.read.1.tlog

?????文件????????414??2017-07-16?22:17??test2\test2\Debug\rc.write.1.tlog

?????文件??????51820??2017-07-16?22:06??test2\test2\Debug\SerialPort.obj

?????文件?????630385??2017-07-16?21:07??test2\test2\Debug\stdafx.obj

?????文件????????667??2017-07-16?21:07??test2\test2\Debug\test2.exe.embed.manifest

?????文件????????732??2017-07-16?21:07??test2\test2\Debug\test2.exe.embed.manifest.res

?????文件????????381??2017-07-16?22:19??test2\test2\Debug\test2.exe.intermediate.manifest

?????文件?????????50??2017-07-16?22:19??test2\test2\Debug\test2.lastbuildstate

?????文件???????2115??2017-07-16?22:19??test2\test2\Debug\test2.log

?????文件??????29991??2017-07-16?22:17??test2\test2\Debug\test2.obj

?????文件???33751040??2017-07-16?21:07??test2\test2\Debug\test2.pch

............此處省略40個文件信息

評論

共有 條評論