CRC_CCITT 16-bit assembly language code - Page 2

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: CRC_CCITT 16-bit assembly language code


Quoted text here. Click to load it

You don't need to worry about the zeroes, as they are typically part of
the data, even if they are not part of the message. For example you are
processing one word at a time, so if there is only one bit data in it there
will be 31 zeroes in the word.

Quoted text here. Click to load it

I'd test it a bit more before calling it finished... I found at least 3 mistakes
in
it that will cause it to fail in various ways. Apart from that you could speed it
up a lot by removing all the redundant instructions. As I said before, it would
be best to start with C, as you'd get much smaller and faster code that way.

Wilco



Re: CRC_CCITT 16-bit assembly language code
Quoted text here. Click to load it
to
there
and
specific
mistakes in
speed it
would
way.
Read the article by Joe Geluso about appending zeroes and also read th
CRC_CCITT specifications document. Zeroes have nothing to do with data.

my code as i said is application specific. Also i don't need to start wit
C as there is a lot of good code already written in C that is free for al
to use. Why would anybody want to develop source code in C from scratc
when there's superfast crc code already splattered across websites al
over the world?

My code spits out the right answer for data ranging from 1 byte to as man
words in any permutation and combination (for example 2 words and 1 byte
as i possibly require for my application. My application will never have
single bit data so it does not interest to me pursue those avenues.

State those 3 mistakes instead of just making a blank statement and als
state the redundant instructions.

Undoubtedly the code can be speeded up.

Only make statements if you have concrete "assembly language " code t
support your statements.

Vy



Re: CRC_CCITT 16-bit assembly language code

Quoted text here. Click to load it


There are lots of ways of appending zeroes, but few would put code to do
this in the middle of the inner loop...

Quoted text here. Click to load it

So why don't you use it then? Assembler is really only necessary if you
can't get the required performance from C.

Quoted text here. Click to load it

If you only process bytes then any of the routines posted would be fine.

Quoted text here. Click to load it

I'd like you to have a good look at the code yourself. For example, the code
enters an infinite loop if you call crc_16 with R3 = 8 or 16. With R3 = 24 or 32
the code simply ignores the given data and enters the zero bit loop instead.
It corrupts bit 0 of the CRC when it returns. Finally it uses various registers
without saving/restoring them, so if you call the routine from C the application
will crash.

Wilco



Re: CRC_CCITT 16-bit assembly language code
Quoted text here. Click to load it
the
data.
with
all
scratch
many
byte)
Quoted text here. Click to load it
have a
also
code
24 or 32
Quoted text here. Click to load it
instead.
registers
application


thanks !!!


Quoted text here. Click to load it

Re: CRC_CCITT 16-bit assembly language code

Quoted text here. Click to load it

Why not use a lookup table? Like:

http://www.nulib.com/library/Crc16.c.txt


What is driving assembly language? The table solution is FAST--if you have
sufficient memory.

Bo



Site Timeline