#include "stdafx.h"
#include "SerialPort.h"
#include
using namespace std;
int main(int argc, char* argv[])
{
CSerialPort mySerialPort;
if (!mySerialPort.InitPort(2))
{
cout << "initport fail !" <<endl;
}
else
{
cout << "initport success !" <<endl;
}
if (!mySerialPort.OpenListenThread())
{
cout << "open fail!"<<endl;
}
else
{
cout <<"open success !"<<endl;
}
return 0;
}
串口通信协议用了现成的代码,但测试串口通信的时候监听现成开启成功,但是初始化化不成功,为什么?用串口助手测试过,通信连接没问题。
求大神们帮帮忙,万分感谢!