在串口通讯中如何自定义数据包,有没有相关的网上资料。
自己定义一个结构:
例如:
typedef struct
{
char name[20];
char xb[5];
int age;
}people;
每次发送的时候,你就发送一个这样的结构数据包……
如:
people p1;
strcpy(p1.name,"abc");
strcpy(p1.xb,"1);
p1.age=20;
long ret;
WriteFile(hfile,(void*)&p1,sizeof(people),&ret,NULL);
……