CserialPort 类的用法打开串口:if (m_Comm.InitPort(this,3,115200,n,8,1,EV_RXCHAR, 512) /接收数据类型为 /EV_RXCHAR,缓冲区大小为 512m_Comm.StartMonitoring(); /启动线程m_IsOpen = true;elseAfxMessageBox(“没有发现此串口或被占用 “);关闭串口:if(m_IsOpen) /如果串口是打开的,则关闭串口m_Comm.ClosePort();发送数据:if(!m_IsOpen)AfxMessageBox(_T(“串口没有打开!“);elsem_Comm.WriteToPort(m_strSend);接收数据:LRESULT CTestDlg:OnReceiveChar(UINT ch, LONG port)CString str;str.Format(_T(“%c“),ch);m_edContext.SetSel(m_edContext.GetWindowTextLength(),m_edContext.GetWindowTextLength();m_edContext.ReplaceSel(str);return 0L;