CRC的手算过程——MODBUS

软件计算结果:

原理参考下面的文章:

https://www.cnblogs.com/esestt/archive/2007/08/09/848856.html

https://blog.csdn.net/weixin_44256803/article/details/105805628

https://blog.csdn.net/d_leo/article/details/73572373

手算过程如下:

MODBUS:16位CRC,初始值0xFFFF,多项式0x8005,输入取反,输出取反。

第一步:原始数据 = "00010001 00100010 00110011 01000100 01010101 01100110 01110111 0000 0000 0000 0000";(就是十六进制11 22 33 44 55 66 77转成二进制,再在尾部增加16位0)。

第二步:按字节取反(输入取反) = "10001000 01000100 11001100 00100010 10101010 01100110 11101110 0000 0000 0000 0000";

第三步:前16位与初始值0xFFFF做异或运算:

然后运算过程如下:长的是被除数,短的是除数(多项式0x8005)

c 复制代码
011101111011101111001100001000101010101001100110111011100000000000000000(前16位与初始值做了异或运算)
 11000000000000101(多项式0x8005)
000101111011101010001100001000101010101001100110111011100000000000000000
   11000000000000101
000011111011101011011100001000101010101001100110111011100000000000000000
    11000000000000101
000000111011101011110100001000101010101001100110111011100000000000000000
      11000000000000101
000000001011101011111110001000101010101001100110111011100000000000000000
        11000000000000101
000000000111101011111100101000101010101001100110111011100000000000000000
         11000000000000101
000000000001101011111101111000101010101001100110111011100000000000000000
           11000000000000101
000000000000001011111101101100101010101001100110111011100000000000000000
              11000000000000101
000000000000000111111101101110001010101001100110111011100000000000000000
               11000000000000101
000000000000000001111101101111011010101001100110111011100000000000000000
                 11000000000000101
000000000000000000011101101111001110101001100110111011100000000000000000
                   11000000000000101
000000000000000000000101101111001011101001100110111011100000000000000000
                     11000000000000101
000000000000000000000011101111001010111001100110111011100000000000000000
                      11000000000000101
000000000000000000000000101111001010010001100110111011100000000000000000
                        11000000000000101
000000000000000000000000011111001010011011100110111011100000000000000000
                         11000000000000101
000000000000000000000000000111001010011110100110111011100000000000000000
                           11000000000000101
000000000000000000000000000001001010011111110110111011100000000000000000
                             11000000000000101
000000000000000000000000000000101010011111100010111011100000000000000000
                              11000000000000101
000000000000000000000000000000011010011111101000111011100000000000000000
                               11000000000000101
000000000000000000000000000000000010011111101101111011100000000000000000
                                  11000000000000101
000000000000000000000000000000000001011111101101010011100000000000000000
                                   11000000000000101
000000000000000000000000000000000000111111101101000111100000000000000000
                                    11000000000000101
000000000000000000000000000000000000001111101101001101100000000000000000
                                      11000000000000101
000000000000000000000000000000000000000011101101001111000000000000000000
                                        11000000000000101
000000000000000000000000000000000000000000101101001111101000000000000000
                                          11000000000000101
000000000000000000000000000000000000000000011101001111100010000000000000
                                           11000000000000101
000000000000000000000000000000000000000000000101001111100111000000000000
                                             11000000000000101
000000000000000000000000000000000000000000000011001111100110010000000000
                                              11000000000000101
000000000000000000000000000000000000000000000000001111100110111000000000
                                                  11000000000000101
000000000000000000000000000000000000000000000000000011100110111010100000
                                                    11000000000000101
000000000000000000000000000000000000000000000000000000100110111010001000
                                                      11000000000000101
000000000000000000000000000000000000000000000000000000010110111010000010
                                                       11000000000000101
000000000000000000000000000000000000000000000000000000001110111010000111

最后16位取反(输出取反),得0xE177。

相关推荐
上海易硅智能科技局有限公司1 分钟前
AG32 MCU 的电机控制方案
单片机·嵌入式硬件
MikelSun2 小时前
电压控制环与电流控制环
单片机·嵌入式硬件·物联网
陌夏微秋3 小时前
STM32单片机芯片与内部45 UART 不定长度接收 标志位结束 定时器超时 串口空闲中断
stm32·单片机·嵌入式硬件·信息与通信·智能硬件
挥剑决浮云 -4 小时前
STM32学习之 按键/光敏电阻 控制 LED/蜂鸣器
c语言·经验分享·stm32·单片机·嵌入式硬件·学习
Whappy0015 小时前
第13部分 1.STM32之PWR电源控制-----4个实验
stm32·单片机·嵌入式硬件
冲,干,闯6 小时前
单片机里不想阻塞系统的延时
单片机·嵌入式硬件
小菜鸟学代码··7 小时前
STM32中断详解
stm32·单片机·嵌入式硬件
芒果de香蕉皮7 小时前
mavlink移植到单片机stm32f103c8t6,实现接收和发送数据
stm32·单片机·嵌入式硬件·算法·无人机
musir19 小时前
stm32四联七段数码管,LED8*8点阵
stm32·单片机·嵌入式硬件
1101 11019 小时前
STM32-笔记16-定时器中断点灯
笔记·stm32·单片机