我想问一下OnCommNotify 这个事件是否有自动刷新的功能?我在这个时间里的程序如下:
unsigned char Buf1[24],Buf2[24],Buf3[24];
int mBuf1=0,mBuf2=0,mBuf3=0;
unsigned long int data1[3],data2[3],data3[3];
unsigned char Buffer[4000]; //接收缓存
int n = YbCommDevice1->Read(Buffer,4000); //收到数据的字节数
if(n>0)
{
for(int i=0; i {
if(i%4==0)
switch(Buffer[i])
{
case 1: Buf1[mBuf1*4+0]=Buffer[i];
Buf1[mBuf1*4+1]=Buffer[i+1];
Buf1[mBuf1*4+2]=Buffer[i+2];
Buf1[mBuf1*4+3]=Buffer[i+3];
mBuf1=mBuf1+1;
break;
case 2: Buf2[mBuf2*4+0]=Buffer[i];
Buf2[mBuf2*4+1]=Buffer[i+1];
Buf2[mBuf2*4+2]=Buffer[i+2];
Buf2[mBuf2*4+3]=Buffer[i+3];
mBuf2=mBuf2+1;
break;
case 3: Buf3[mBuf3*4+0]=Buffer[i];
Buf3[mBuf3*4+1]=Buffer[i+1];
Buf3[mBuf3*4+2]=Buffer[i+2];
Buf3[mBuf3*4+3]=Buffer[i+3];
mBuf3=mBuf3+1;
break;
}
data1[0]=Buf1[1]*256^2+Buf1[2]*256+Buf1[3];//
data1[1]=Buf2[1]*256^2+Buf2[2]*256+Buf2[3];
data1[2]=Buf3[1]*256^2+Buf3[2]*256+Buf3[3];
}
}
怎么接收到的始终是第一组数据?它不是应该自动覆盖前面发的?我现在急用程序,日思夜想,还没人指导,只好求你帮忙了.谢谢!
--------------------next---------------------
阅读(1319) | 评论(0) | 转发(0) |