当前位置:网站首页>A camera communication protocol verification CRC program
A camera communication protocol verification CRC program
2022-06-10 09:23:00 【vzhb】
programing language :c Language
According to the set algorithm rules , Input string , Calculated calibration data ;
The code is as follows :
#include <stdio.h>
int main(void)
{
//unsigned char ptr[31] = {0xAA ,0x1F ,0x08 ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x2B ,0xD8 ,0xF9 ,0xFF ,0xFF ,0xA0 ,0xB3 ,0x01 ,0x00 ,0x56 ,0xD2 ,0x04 ,0x00 ,0x00 ,0x3F ,0x3C ,0x34 ,0x01,0x00};
unsigned char ptr[31] = {0xAA ,0x1F ,0x08 ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x2B ,0xEF ,0x04 ,0x00 ,0x00 ,0xA0 ,0xB3 ,0x01 ,0x00 ,0x56 ,0xD2 ,0x04 ,0x00 ,0x00 ,0x3F ,0x3C ,0x34 ,0x01,0x00};
unsigned char i ,len;
unsigned char t = 0;
unsigned char crc = 0x00;
len = sizeof(ptr);
// The last bit is reserved for the check bit
int len_t=len-1;
while(len_t--)
{
crc ^= ptr[t++];
for (i=8; i>0; --i)
{
if (crc & 0x80)
{
crc = (crc << 1) ^ 0xD5;
}
else
crc = (crc << 1);
}
}
printf("crc = 0x%x \n",crc);
ptr[len-1] = crc;
for(i=0;i<len;i++)
{
printf("[%02X]",ptr[i]);
}
}The operation results are as follows :

边栏推荐
- 数字藏品平台又传“跑路” :安全性遭疑,严监管在途
- Pipeline pipeline for VTK learning
- Win11 install texlive version 2021
- Rexroth pressure reducing valve 3dr16p5-5x/100y/00m
- request调用 get方法报错以及解决
- Formula Derivation
- 案例分享 | 数智化升级:红蜻蜓的转型之路(下)
- 技能树评测
- BlockingQueue、SynchronousQueue、ArrayBlockingQueue、ReentrantLock、Semaphore、公平与非公平
- 网页免费 字体库
猜你喜欢

谈谈数字化转型成功的10个启示

某相机通信协议校验CRC程序

Texture mapping for VTK learning

Coordinate system of VTK learning

The 21st layer of leetcode Langya list - numbers that only appear once

How to hide application previews when switching applications while using shutter

Talk about the trend of digital transformation in 2022

技能树评测

Simple creation of database views, indexes, stored procedures and triggers

From zero to one, one-stop solution to MySQL under linux environment (download)
随机推荐
互联网公司研发效能团队为啥必须独立?何时独立?
Task06: Autumn move script B
Data governance in industrial digital transformation
Alignment HR_ MySQL logical architecture? That's it?
消息队列选型手册
Contact IC card - STM32 (smart card)
It only takes eight steps to package the applet to generate an app
想做钢铁侠?听说很多大佬都是用它入门的
Task03: more complex query (2)
请问手机办理股票开户安全吗?
CString string splitting function
Enlightenment from Alibaba's digital transformation
win11下配置vscode+cmake
QQ wechat enables continuous message sending [code implementation]
对C语言指针强转的理解
Principal Component Analysis
GNSS定位资料收集
36 krypton's initial launch 𞓜 sustainable development of new generation ipoct products | ihong health | completed a new round of financing of tens of millions of yuan
Oracle dual 表生成多行伪记录
Wechat applet component observers [listener] uses this to report an error undefined