e truyền kí tự từ thẻ từ qua pic rui từ pic truyền lên pc nhưng bi lỗi kí tự! vd id thẻ là 123456789, e dùng chươgn trình tẻminal nhận thì đúng là nó,e dùng chương trình của bác NgôHảiBắc (vs2010) thì nhận bi lỗi kí tự nó ra như thế này 123?4?5?6?78?9 ......các bác giúp e với !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
oid CRS232TUTDlg::OnCommMscomm1()
{
UpdateData();
// count+=1;
VARIANT data;
switch (m_mscomm1.get_CommEvent()){
case 1: // comEvSend
break;
case 2: // comEvReceive
data =m_mscomm1.get_Input();
m_strReceive += (CString)data.bstrVal;
if (count==500){
m_strReceive="";
count=0;
}
// UpdateData(FALSE);
break;
case 3: // comEvCTS
/////////////////////////
void CRS232TUTDlg::Settings(void)
{
// if port is already opened then close port.
if( m_mscomm1.get_PortOpen())
m_mscomm1.put_PortOpen(false);
// Setting comport
m_mscomm1.put_CommPort(m_cboComPort.GetCurSel()+ 1);
// Setting Handshaking
m_mscomm1.put_Handshaking(m_cboHandshaking.GetCurS el());
// Thiet lap tan so bit du lieu bit stop
CString strBitRate = getCurStrInCombobox(m_cboBitRate);
CString strParity = getCurStrInCombobox(m_cboParityBit);
CString strDataBit = getCurStrInCombobox(m_cboDataBit);
CString strStopBit = getCurStrInCombobox(m_cboStopBit);
CString strSetting;
strSetting.Format(L"%s,%c,%s,%s",strBitRate,strPar ity[1],strDataBit,strStopBit);
m_mscomm1.put_Settings(strSetting); //"9600,N,8,1");
m_mscomm1.put_RThreshold(1); //
// set for input direction
m_mscomm1.put_InputLen(1); // Moi lan doc mot ky tu
m_mscomm1.put_InBufferSize(1024);
m_mscomm1.put_InputMode(0); // 0- text mode, 1- binary mode
m_mscomm1.put_OutBufferSize(1024);
m_mscomm1.put_PortOpen(true); // mo cong
}
oid CRS232TUTDlg::OnCommMscomm1()
{
UpdateData();
// count+=1;
VARIANT data;
switch (m_mscomm1.get_CommEvent()){
case 1: // comEvSend
break;
case 2: // comEvReceive
data =m_mscomm1.get_Input();
m_strReceive += (CString)data.bstrVal;
if (count==500){
m_strReceive="";
count=0;
}
// UpdateData(FALSE);
break;
case 3: // comEvCTS
/////////////////////////
void CRS232TUTDlg::Settings(void)
{
// if port is already opened then close port.
if( m_mscomm1.get_PortOpen())
m_mscomm1.put_PortOpen(false);
// Setting comport
m_mscomm1.put_CommPort(m_cboComPort.GetCurSel()+ 1);
// Setting Handshaking
m_mscomm1.put_Handshaking(m_cboHandshaking.GetCurS el());
// Thiet lap tan so bit du lieu bit stop
CString strBitRate = getCurStrInCombobox(m_cboBitRate);
CString strParity = getCurStrInCombobox(m_cboParityBit);
CString strDataBit = getCurStrInCombobox(m_cboDataBit);
CString strStopBit = getCurStrInCombobox(m_cboStopBit);
CString strSetting;
strSetting.Format(L"%s,%c,%s,%s",strBitRate,strPar ity[1],strDataBit,strStopBit);
m_mscomm1.put_Settings(strSetting); //"9600,N,8,1");
m_mscomm1.put_RThreshold(1); //
// set for input direction
m_mscomm1.put_InputLen(1); // Moi lan doc mot ky tu
m_mscomm1.put_InBufferSize(1024);
m_mscomm1.put_InputMode(0); // 0- text mode, 1- binary mode
m_mscomm1.put_OutBufferSize(1024);
m_mscomm1.put_PortOpen(true); // mo cong
}
Comment