• 大小: 32KB
    文件类型: .cpp
    金币: 1
    下载: 0 次
    发布日期: 2021-06-05
  • 语言: C/C++
  • 标签: RS232  串口  c++  Linux  

资源简介

本资源为利用RS232进行串口通信操作,编程语言为c++,环境为Ubuntu,并用串口调试助手实测,无数据丢失!

资源截图

代码片段和文件信息

#include/*标准输入输出定义*/
#include/*标准函数库定义*/
#include/*Unix 标准函数定义*/   
#include 
#include  
#include/*文件控制定义*/
#include/*POSIX 终端控制定义*/
#include    
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
using namespace cv;
int fd;
int all_num=0;
std::mutex serialmutex;
Mat goodbad;
struct timeval starttime;
struct timeval endtime;
//CRC16 1021校验
const unsigned short crc16_table[256] =
{
0x00000x10210x20420x30630x40840x50a50x60c60x70e7
0x81080x91290xa14a0xb16b0xc18c0xd1ad0xe1ce0xf1ef
0x12310x02100x32730x22520x52b50x42940x72f70x62d6
0x93390x83180xb37b0xa35a0xd3bd0xc39c0xf3ff0xe3de
0x24620x34430x04200x14010x64e60x74c70x44a40x5485
0xa56a0xb54b0x85280x95090xe5ee0xf5cf0xc5ac0xd58d
0x36530x26720x16110x06300x76d70x66f60x56950x46b4
0xb75b0xa77a0x97190x87380xf7df0xe7fe0xd79d0xc7bc
0x48c40x58e50x68860x78a70x08400x18610x28020x3823
0xc9cc0xd9ed0xe98e0xf9af0x89480x99690xa90a0xb92b
0x5af50x4ad40x7ab70x6a960x1a710x0a500x3a330x2a12
0xdbfd0xcbdc0xfbbf0xeb9e0x9b790x8b580xbb3b0xab1a
0x6ca60x7c870x4ce40x5cc50x2c220x3c030x0c600x1c41
0xedae0xfd8f0xcdec0xddcd0xad2a0xbd0b0x8d680x9d49
0x7e970x6eb60x5ed50x4ef40x3e130x2e320x1e510x0e70
0xff9f0xefbe0xdfdd0xcffc0xbf1b0xaf3a0x9f590x8f78
0x91880x81a90xb1ca0xa1eb0xd10c0xc12d0xf14e0xe16f
0x10800x00a10x30c20x20e30x50040x40250x70460x6067
0x83b90x93980xa3fb0xb3da0xc33d0xd31c0xe37f0xf35e
0x02b10x12900x22f30x32d20x42350x52140x62770x7256
0xb5ea0xa5cb0x95a80x85890xf56e0xe54f0xd52c0xc50d
0x34e20x24c30x14a00x04810x74660x64470x54240x4405
0xa7db0xb7fa0x87990x97b80xe75f0xf77e0xc71d0xd73c
0x26d30x36f20x06910x16b00x66570x76760x46150x5634
0xd94c0xc96d0xf90e0xe92f0x99c80x89e90xb98a0xa9ab
0x58440x48650x78060x68270x18c00x08e10x38820x28a3
0xcb7d0xdb5c0xeb3f0xfb1e0x8bf90x9bd80xabbb0xbb9a
0x4a750x5a540x6a370x7a160x0af10x1ad00x2ab30x3a92
0xfd2e0xed0f0xdd6c0xcd4d0xbdaa0xad8b0x9de80x8dc9
0x7c260x6c070x5c640x4c450x3ca20x2c830x1ce00x0cc1
0xef1f0xff3e0xcf5d0xdf7c0xaf9b0xbfba0x8fd90x9ff8
0x6e170x7e360x4e550x5e740x2e930x3eb20x0ed10x1ef0
};


struct OpenRequest//开门通知
{
char inout;//进出站编码1
    char inouttime[7];//进出站时间7
char inpath;//进站线路代码1
    char instation[2];//进站车站代码2
    char inoutdevice[4];//进出站设备代码4
    char faceregister[18];//人脸注册ID18
    char authcode[16];//唯一认证码16
    char outneed[2];//进出站需代购乘资2
};
struct FaceinfoUpload//人脸信息上报
{
char flag;
char faceregisterid[18];
char similarity[5];
char reserve1[64];
};
struct HeartM_StateGet//心跳管理_状态获取
{
char devicecode[10];
char softversio

评论

共有 条评论