Hello, I am using AT89C51RD2 as a target processor operates on 11.0592MHz crystal oscillator. In my application I get command through serial port.It supports two checksum alogorithms one is standard CRC16 and another is Prop.Checksum but in the command it is not mentioned which CRC is in this command hence I have to do calculation of which CRC is this.For this calculation it takes more time than required. Can you please tell me how to increase the execution speed? Also how to bring uc in X2 mode by keeping same baudrate and timer tick?
Use a 256-element array with 16-bit precomputed numbers. Then you will nod need any bit or nibble loop in the CRC evaluation. It will instead be able to consume one byte/iteration.
The world is full of tabulated implementations of CRC. Use Google.
The next step up: Convert into assembler.
But are your serial data arriving at such speed that you have problems with time? What baudrate do you use? Note that you can compute the CRC on-the-fly when receiving the serial packet, to reduce the response time when decoding/processing the command.
Hello, Serial data comes at 9600bps.
Max 1 ms/character - then it shouldn't be a problem to compute a crc-16 and still have plenty of time for other tasks.