第一范文网 - 专业文章范例文档资料分享平台

(完整版)RFID毕业课程设计

来源:用户分享 时间:2025/6/1 1:33:56 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

}

} return 0;

}

if(invFlag ==true){ }

if(accLen

continue; flag = true;

tagNum =buffer[2]; for(;tagNum>0;tagNum--){ }

if((tagNum-1) != num &&(tagNum!=0&&num!=0))

continue;

length = buffer[1];

commandLength+=buffer[1+commandLength]; num = buffer[2+commandLength]; if((tagNum-1) !=num)

break;

if(commandLength

continue;

m=-1; flag=true;

UINT WINAPI CSerialPort::ListenThread( void* pParam ) {

** 得到本类的指针 *

CSerialPort *pSerialPort = reinterpret_cast(pParam); ** 读取输入缓冲区中的数据并输出显示 * char cRecved = 0x00; accum = -1;

if(buffer != NULL){ delete []buffer; }

buffer = new char[1000]; 线程循环,轮询方式读取串口数据 while (!pSerialPort->s_bExit) {

UINT BytesInQue = pSerialPort->GetBytesInCOM(); ** 如果串口输入缓冲区中无数据,则休息一会再查询 * ** 如果Inventory标志位为true,等一轮结束再接受* if ( BytesInQue == 0 && flag1 ==false) if ( BytesInQue == 0) {

Sleep(SLEEP_TIME_INTERVAL); continue; } do {

cRecved = 0x00;

if(pSerialPort->ReadChar(cRecved)) {

accum++;

buffer[accum] = cRecved; }

}while(--BytesInQue); } return 0; }

void CSerialPort::flush(){ }

bool CSerialPort::read(int beg, int len, char arr[]){ }

bool CSerialPort::ReadChar( char &cRecved )这里cRecved是引用 {

BOOL bResult = TRUE; while(len

Sleep(1); m=-1; rdLen = 0;

arr = new char[len];

for(int i=beg;i

arr[i] = buffer[i+rdLen];

rdLen+=len;

}

bool CSerialPort::WriteData( unsigned char* pData, unsigned int length ) {

for(int i=0;i

buffer[i] ='\\0'; DWORD BytesRead = 0; if(m_ false; }

** 临界区保护 *

EnterCriticalSection(&m_csCommunicationSync); ** 从缓冲区读取一个字节的数据 *

bResult = ReadFile(m_(&m_csCommunicationSync); }

** 离开临界区 *

LeaveCriticalSection(&m_csCommunicationSync); return (BytesRead == 1);

return false;

BOOL bResult = TRUE; DWORD BytesToSend = 0; if(m_ false; }

** 临界区保护 *

EnterCriticalSection(&m_csCommunicationSync); ** 向缓冲区写入指定量的数据 *

bResult = WriteFile(m_(&m_csCommunicationSync);

搜索更多关于: (完整版)RFID毕业课程设计 的文档
(完整版)RFID毕业课程设计.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c40tgr2vw5m3y3j84vsq02xzhu2kzfw009rp_9.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top