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

資源簡(jiǎn)介

VS與單片機(jī)串口數(shù)據(jù)傳輸、計(jì)算機(jī)與單片機(jī)通信 在VS2017里寫(xiě)的,親測(cè)可用

資源截圖

代碼片段和文件信息

#include???
#include???
#include???
#include?



using?namespace?std;
HANDLE?hComm;
OVERLAPPED?OverLapped;
COMSTAT?Comstat;
DWORD?dwCommEvents;


bool?OpenPort();??//打開(kāi)串口??
bool?SetupDCB(int?rate_arg);??//設(shè)置DCB??
bool?SetupTimeout(DWORD?ReadInterval?DWORD?ReadTotalMultiplier?DWORD
ReadTotalConstant?DWORD?WriteTotalMultiplier?DWORD?WriteTotalConstant);???//設(shè)置超時(shí)??
void?ReciveChar();???//接收字符??
bool?WriteChar(char*?szWriteBuffer?DWORD?dwSend);??//發(fā)送字符??

bool?OpenPort()
{
hComm?=?CreateFile(L“COM3“//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!此處更改com口!?。。。。。。。。。。。。?!
GENERIC_READ?|?GENERIC_WRITE
0
0
OPEN_EXISTING
FILE_FLAG_OVERLAPPED
0);
if?(hComm?==?INVALID_HANDLE_VALUE)
return?FALSE;
else
return?true;
}

bool?SetupDCB(int?rate_arg)
{
DCB?dcb;
memset(&dcb?0?sizeof(dcb));
if?(!GetCommState(hComm?&dcb))//獲取當(dāng)前DCB配置??
{
return?FALSE;
}
dcb.DCBlength?=?sizeof(dcb);
/*?----------?Serial?Port?Config?-------?*/
dcb.BaudRate?=?rate_arg;
dcb.Parity?=?NOPARITY;
dcb.fParity?=?0;
dcb.StopBits?=?ONESTOPBIT;
dcb.ByteSize?=?8;
dcb.fOutxCtsFlow?=?0;
dcb.fOutxDsrFlow?=?0;
dcb.fDtrControl?=?DTR_CONTROL_DISABLE;
dcb.fDsrSensitivity?=?0;
dcb.fRtsControl?=?RTS_CONTROL_DISABLE;
dcb.fOutX?=?0;
dcb.fInX?=?0;
dcb.fErrorChar?=?0;
dcb.fBinary?=?1;
dcb.fNull?=?0;
dcb.fAbortonerror?=?0;
dcb.wReserved?=?0;
dcb.XonLim?=?2;
dcb.XoffLim?=?4;
dcb.XonChar?=?0x13;
dcb.XoffChar?=?0x19;
dcb.EvtChar?=?0;
if?(!SetCommState(hComm?&dcb))
{
return?false;
}
else
return?true;
}

bool?SetupTimeout(DWORD?ReadInterval?DWORD?ReadTotalMultiplier?DWORD
ReadTotalConstant?DWORD?WriteTotalMultiplier?DWORD?WriteTotalConstant)
{
COMMTIMEOUTS?timeouts;
timeouts.ReadIntervalTimeout?=?ReadInterval;
timeouts.ReadTotalTimeoutConstant?=?ReadTotalConstant;
timeouts.ReadTotalTimeoutMultiplier?=?ReadTotalMultiplier;
timeouts.WriteTotalTimeoutConstant?=?WriteTotalConstant;
timeouts.WriteTotalTimeoutMultiplier?=?WriteTotalMultiplier;
if?(!SetCommTimeouts(hComm?&timeouts))
{
return?false;
}
else
return?true;
}

void?ReciveChar()
{
bool?bRead?=?TRUE;
bool?bResult?=?TRUE;
DWORD?dwError?=?0;
DWORD?BytesRead?=?0;
char?RXBuff;
for?(;;)
{
bResult?=?ClearCommError(hComm?&dwError?&Comstat);
if?(Comstat.cbInQue?==?0)
continue;
if?(bRead)
{
bResult?=?ReadFile(hComm??//通信設(shè)備(此處為串口)句柄,由CreateFile()返回值得到??
&RXBuff??//指向接收緩沖區(qū)??
1??//指明要從串口中讀取的字節(jié)數(shù)??
&BytesRead???//??
&OverLapped);??//OVERLAPPED結(jié)構(gòu)??
std::cout?< if?(!bResult)
{
switch?(dwError?==?GetLastError())
{
case?ERROR_IO_PENDING:
bRead?=?FALSE;
break;
default:
break;
}
}
}
else
{
bRead?=?TRUE;
}
}
if?(!bRead)
{
bRead?=?TRUE;
bResult?=?GetOverlappedResult(hComm
&OverLapped
&BytesRead
TRUE)

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----

?????文件????????415??2017-08-11?00:34??VS與單片機(jī)串口數(shù)據(jù)傳輸\readme.txt

?????文件??????71680??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\Debug\test2.exe

?????文件?????812020??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\Debug\test2.ilk

?????文件????1174528??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\Debug\test2.pdb

?????文件???????3806??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\test2.log

?????文件???????1434??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\test2.tlog\cl.command.1.tlog

?????文件??????22128??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\test2.tlog\CL.read.1.tlog

?????文件????????624??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\test2.tlog\CL.write.1.tlog

?????文件???????3490??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\test2.tlog\link.command.1.tlog

?????文件???????4618??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\test2.tlog\link.read.1.tlog

?????文件????????608??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\test2.tlog\link.write.1.tlog

?????文件????????233??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\test2.tlog\test2.lastbuildstate

?????文件????1240064??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\vc120.idb

?????文件?????438272??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\vc120.pdb

?????文件?????186805??2018-04-05?03:02??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\Debug\源.obj

?????文件???????4081??2017-08-11?00:23??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\test2.vcxproj

?????文件????????944??2017-08-11?00:23??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\test2.vcxproj.filters

?????文件???????4718??2018-04-05?03:04??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2\源.cpp

?????文件???31916032??2018-04-05?03:54??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2.sdf

?????文件????????961??2017-08-11?00:20??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2.sln

????..A..H.?????30720??2018-04-05?03:54??VS與單片機(jī)串口數(shù)據(jù)傳輸\win32控制臺(tái)程序發(fā)送串口數(shù)據(jù)\test2.v12.suo

?????文件??????89088??2017-08-11?00:15??VS與單片機(jī)串口數(shù)據(jù)傳輸\攝像頭識(shí)小球串口發(fā)送數(shù)據(jù)\Debug\test.exe

?????文件?????618704??2017-08-11?00:15??VS與單片機(jī)串口數(shù)據(jù)傳輸\攝像頭識(shí)小球串口發(fā)送數(shù)據(jù)\Debug\test.ilk

?????文件????2026496??2017-08-11?00:15??VS與單片機(jī)串口數(shù)據(jù)傳輸\攝像頭識(shí)小球串口發(fā)送數(shù)據(jù)\Debug\test.pdb

?????文件??????19968??2017-08-10?23:53??VS與單片機(jī)串口數(shù)據(jù)傳輸\攝像頭識(shí)小球串口發(fā)送數(shù)據(jù)\Release\test.exe

?????文件????1297408??2017-08-10?23:54??VS與單片機(jī)串口數(shù)據(jù)傳輸\攝像頭識(shí)小球串口發(fā)送數(shù)據(jù)\Release\test.pdb

?????文件???????3242??2017-08-11?00:15??VS與單片機(jī)串口數(shù)據(jù)傳輸\攝像頭識(shí)小球串口發(fā)送數(shù)據(jù)\test\Debug\test.log

?????文件????????596??2017-08-11?00:15??VS與單片機(jī)串口數(shù)據(jù)傳輸\攝像頭識(shí)小球串口發(fā)送數(shù)據(jù)\test\Debug\test.tlog\cl.command.1.tlog

?????文件??????25198??2017-08-11?00:15??VS與單片機(jī)串口數(shù)據(jù)傳輸\攝像頭識(shí)小球串口發(fā)送數(shù)據(jù)\test\Debug\test.tlog\CL.read.1.tlog

?????文件????????384??2017-08-11?00:15??VS與單片機(jī)串口數(shù)據(jù)傳輸\攝像頭識(shí)小球串口發(fā)送數(shù)據(jù)\test\Debug\test.tlog\CL.write.1.tlog

............此處省略40個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源