摘要
在工业现场通信过程中为保证数据传输的正确性,采用了CRC校验码,并且选择了基于查表法来提高生成CRC码的效率。通用查表法中每次计算出1个字节的CRC码,处理效率不高,所以提出了一种基于通用查表法的一种改进算法。改进后的算法每次处理2个字节,即计算出2个字节的CRC校验码,并且需要分别保留这2个字节的CRC码。下一组的2个字节信息输入后,借助前面两个字节的CRC校验码计算出后面两个字节的CRC校验码。以此类推,每一组的2个字节的CRC码都是在上一组2个字节的CRC码的基础上计算获得,直到所有信息输入完毕。在进行实验验证后,结果表明该算法运行时间相对有所减少。
In order to judge the correctness of data transmission in Industrial field, the Cyclic Redundancy Check look-up table algorithm is adopted in the CRC code. An improved algorithm is proposed based on general look-up table algorithm. It could read 2 bytes once, and calculate the CRC code of 2 bytes, but the two CRC codes does not been merged in the improved algo- rithm. After reading a group of 2 bytes information, according to the previous two bytes CRC code to calculate the following 2 bytes CRC code, until all the information input is completed. After the experimental verification, the results show that the run- ning time of the algorithm is relatively reduced.
出处
《微型电脑应用》
2017年第8期12-14,共3页
Microcomputer Applications
基金
国家自然科学基金项目(61502094)
黑龙江省自然科学基金项目(F2016002)