Skip to content

Commit

Permalink
1.Update README.md
Browse files Browse the repository at this point in the history
2.Update How To Use.txt
  • Loading branch information
itas109 committed Feb 14, 2017
1 parent 17de5a4 commit 3655ca5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
18 changes: 10 additions & 8 deletions How To Use.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
1��ON_MESSAGE(WM_COMM_RXSTR, &CtkrrfaceDlg::OnReceiveString)
1.���ڿ���
if (m_SerialPort.InitPort(this->GetSafeHwnd(), SelPortNO)//���ں�
{
m_SerialPort.StartMonitoring();//��������
}

2��LRESULT CtkrrfaceDlg::OnReceiveString(WPARAM str, LPARAM port)///������Ϣ��Ӧ����
2.ON_MESSAGE(WM_COMM_RXSTR, &CtkrrfaceDlg::OnReceiveString)

3.LRESULT CtkrrfaceDlg::OnReceiveString(WPARAM str, LPARAM port)///������Ϣ��Ӧ����
{
char dest[13];
//char des[13];
memcpy(dest,(char*)str,13*sizeof(char));//13Ϊ�ַ����ȣ���Ҫ�޸�
...
}

3�����Ҫת�����ֽںͶ��ֽڽ��գ������޸ĺ궨��
4.���Ҫת�����ֽںͶ��ֽڽ��գ������޸ĺ궨��
#define IsReceiveString 1
ReceiveString 1���ַ������գ���Ӧ��Ӧ����ΪWM_COMM_RXSTR����ReceiveString 0һ���ַ�һ���ַ����գ���Ӧ��Ӧ����ΪWM_COMM_RXCHAR��

4��
//���ֻ��һ�������շ����ݣ����Դ����ȡ���ȣ���ΪRXBuff�п��ܰ���'\0'��ASCIIΪ00
//::SendMessage((port->m_pOwner)->m_hWnd, WM_COMM_RXSTR, (WPARAM) RXBuff, BytesRead);

5�����ڹرպ���
5.���ڹرպ���
void OnClose()
{
// TODO: Add your message handler code here and/or call default
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,12 @@ by itas109 on 2016-08-10
http://blog.csdn.net/itas109
https://github.com/itas109
* 改进ReceiveStr方法,comstat.cbInQue = 0xcccccccc的情况(如串口异常断开),会导致RXBuff初始化失败

by itas109 on 2017-02-14
http://blog.csdn.net/itas109
https://github.com/itas109
* 兼容ASCII和UNICODE编码
* ReceiveStr函数中发送函数SendMessage的第二个参数采用结构体形式,包括portNr串口号和bytesRead读取的字节数,可以处理16进制的时候0x00截断问题
* 精简不必要的函数SendData和RecvData
* 尽量的取消对 MFC 的依赖,Hkey2ComboBox函数暂时保留
* 其他小问题修改

0 comments on commit 3655ca5

Please sign in to comment.