Date: 19970722 From: Fernando Belza To: Multiple recipients of list CHIPDIR-L Subject: 8051 CRC software I need CRC soft for 8051 compatible micro (compact and fast is very dificult?). Thankful in advance for all contributions. Fernando Belza TELCRO Argentina Date: 19970722 From: Matthias Weingart To: Multiple recipients of list CHIPDIR-L Subject: Re: 8051 CRC software On Mon, 21 Jul 1997, Fernando Belza wrote: > I need CRC soft for 8051 compatible micro (compact and fast is very > dificult?). Thankful in advance for all contributions. try my 'secret' 8051-source page :-) http://www.boerde.de/~matthias/m8051 Matthias Date: 19970723 From: Luis M. Brugarolas To: Multiple recipients of list CHIPDIR-L Subject: RE: 8051 CRC software This is a *superb* reference on CRC and different alternatives on how to calculate them (fast, low memory...). A Tutorial on CRC Computations Tenkasi V. Ramabadran and Sunil S. Gaitonde IEEE MICRO, Vol. 8, No. 4, August 1988, pag. 62-75 Best regards Luis M. Brugarolas Date: 19970723 From: Jaap van Ganswijk To: CHIPDIR-L Subject: Re: 8051 CRC software At 16:50 1997-07-21 -0800, Fernando Belza wrote: >I need CRC soft for 8051 compatible micro (compact and fast is very >dificult?). Thankful in advance for all contributions. To determine a good CRC protocol it's necessary to know which kind of errors you want to detect and what your transmission medium is. For serial streams: If you want to detect all single bit errors and also certain kinds of burst errors the ISO standards institute (?) has determined a good CRC. You can find it in the Dallas databooks since they use it on their serial bus. Here is my C version of it: //read byte from Touch Memory static uint rd_byte(bus) uint bus; { uchar bit; uint da; //not in char because of shifting! uchar n; for (da=0,n=0;n<8;++n,da>>=1) { da|=(bit=rd_bit(bus))<<8; calc_crc_le(bus,bit); } #if DEBUG_L printf("reading byte %02x\n",da); #endif return da; } //calculate the CRC per bit, in little endian way void calc_crc_le(bus,bit) uint bus; //for this bus uchar bit; //contains bit in b0, rest=0 { uchar cy; Acrc[bus]^=bit; cy=Acrc[bus]; Acrc[bus]>>=1; if (cy&1) Acrc[bus]^=0x8c; } Before starting the stream you should initialize the CRC to 0 and at the end your CRC should be 0 again. This means however that a pure 0-signal is not detected as an error which is generally the reason for inverting the CRC before sending it. These routines can handle several streams on several busses at the same time. If you only have one bus, you can change 'Acrc[bus]' to 'crc' and remove 'bus' as an argument to the function... Greetings, Jaap Date: 19970804 From: Bob Paddock To: Multiple recipients of list CHIPDIR-L Subject: Re: 8051 CRC software >I need CRC16 polynomial implentation. I check a string (received from serial >port) with 2 bytes of message's CRC. I need to compute the message's CRC and >to compare with CRC received for errors. >Thank you Take a look at: ============================================================================= A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS ================================================== "Everything you wanted to know about CRC algorithms, but were afraid to ask for fear that errors in your understanding might be detected." Version : 3. Date : 19 August 1993. Author : Ross N. Williams. FTP : ftp.adelaide.edu.au/pub/rocksoft/crc_v3.txt Also the 'C' SNIPPESTS collection has the code, not hard to port 'C' to 8051 assembly in this case: Internet locations to get SNIPPETS via anonymous ftp: snippets.org /pub/snippets (This is the official SNIPPETS ftp distribution site) juge.com /file/c connectn.acs.niu.edu ~/C ftp.funet.fi /pub/msdos/Simtel/c (Europe) ftp.microdot.com.au /pub/snippets (Australia) ftp.simtel.net /pub/simtelnet/msdos/c (also Simtel CD-ROM) World-Wide Web sites http://www.snippets.org (This is the official SNIPPETS web site home page) http://www.strangecreations.com/strange/library/snippets.htm http://src.doc.ic.ac.uk/packages/simtel-msdos/c/ (Europe) Bob Paddock Date: Mon, 25 Aug 1997 23:48:34 -0800 From: Chiel de Jong To: Multiple recipients of list CHIPDIR-L Subject: RE: 4-bit CRC In the Book "Numerical Recipes in C" by Wiliam A. Press ISBN 0 521 43108 5 you can find for the CRC16, which can be easily adapted. Succes Chiel >---------- >Date: Monday, August 25, 1997 11:19 PM >From: Pedro Criptus >To: Multiple recipients of list CHIPDIR-L >Subject: 4-bit CRC > >Hi to all, > I was wondering if any of you knew a good 4/8bit CRC algorithm, it >wouldn't have to be for long strings since it's only for a 256 byte >string. If any of you know where there's any docs about such an >algorithm PLEASE let me know, it's for a new algorithm that I'm working >on & it will hopefully help the computer world... > See ya, > PEdro >-- >"We Shall Meet Again", > CRIPTUS (15) - Computer programmer & electronic student... > MY COOL PAGES: >http://www.arrakis.es/~criptus > E-MAIL ME: -Ask what you like Chiel de Jong Date: Tue, 26 Aug 1997 15:07:12 -0800 From: Martin Perko To: Multiple recipients of list CHIPDIR-L Subject: RE: 4-bit CRC ------ =_NextPart_000_01BCB697.0F79D1D0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > I was wondering if any of you knew a good 4/8bit CRC algorithm, it >wouldn't have to be for long strings since it's only for a 256 byte >string. If any of you know where there's any docs about such an >algorithm PLEASE let me know, it's for a new algorithm that I'm working >on & it will hopefully help the computer world... If the string will go through a media where compact packets of data is = likely to be corrupted (a few neighbor bits altered), that is, optical = comm., mass storage, wireless comm, you should consider the technique = that CD uses. (Reed Solomon CIRC, I think.) Anyway, the needed error detectiong/correcting depth must in every case = be estimated (as far as I recall the lectures I listened to) on the = following facts: - probability of errors if no correction/detection is used - maximal allowed probability of errors with EC/D used. If the errors are distributed evenly over time and strings, it is then = easy to calculate the ratio of errors that should be detected/corrected. = And hence, to estimate CRC and string length. Note that 100% EC/D is possible ONLY if the EC/D data is infinitely = larger than the string. (I have got the feeling that you think you had = found a method to achieve 100% effectiviness. Maybe the feeling is not = right...) Martin BTW.: check with the IEEE Transactions on... proceedings in library. It = is usally worth to do so. -- Author: Martin Perko Date: Mon, 01 Sep 1997 16:22:52 -0800 From: John Shaw To: Multiple recipients of list CHIPDIR-L Subject: RE: 4-bit CRC Nobody seems to have mentioned that this excellent reference book is =20 on-line at http://nr.harvard.edu/nr/bookcpdf.html for browsing... Author: "Shaw, John" Date: Fri, 29 Aug 1997 18:04:09 -0800 From: Bob Paddock To: Multiple recipients of list CHIPDIR-L Subject: Re: What is CRC? >We've been having this tread about 4-bit CRC lately, but since I'm not a >programmer (exept for PIC's) I've never really had this explained to me. > >Would someone be so kind as to do this for me? You can reply directly to >me or the list (if you feel like and think its relevant to everyone...) CRC's are a way to determine if the data stored or transmitted has been retreived or received correctly. See: +++Date last modified: 05-1997 ============================================================================= A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS ================================================== "Everything you wanted to know about CRC algorithms, but were afraid to ask for fear that errors in your understanding might be detected." Version : 3. Date : 19 August 1993. Author : Ross N. Williams. FTP : ftp.adelaide.edu.au/pub/rocksoft/crc_v3.txt Company : Rocksoft^tm Pty Ltd. Snail : 16 Lerwick Avenue, Hazelwood Park 5066, Australia. Fax : +61 8 373-4911 (c/- Internode Systems Pty Ltd). Phone : +61 8 379-9217 (10am to 10pm Adelaide Australia time). Note : "Rocksoft" is a trademark of Rocksoft Pty Ltd, Australia. Status : Copyright (C) Ross Williams, 1993. However, permission is granted to make and distribute verbatim copies of this document provided that this information block and copyright notice is included. Also, the C code modules included in this document are fully public domain. Thanks : Thanks to Jean-loup Gailly and Mark Adler who both proof read this document and picked out lots of nits as well as some big fat bugs. Table of Contents ----------------- Abstract 1. Introduction: Error Detection 2. The Need For Complexity 3. The Basic Idea Behind CRC Algorithms 4. Polynomial Arithmetic 5. Binary Arithmetic with No Carries 6. A Fully Worked Example 7. Choosing A Poly 8. A Straightforward CRC Implementation 9. A Table-Driven Implementation 10. A Slightly Mangled Table-Driven Implementation 11. "Reflected" Table-Driven Implementations 12. "Reversed" Polys 13. Initial and Final Values 14. Defining Algorithms Absolutely 15. A Parameterized Model For CRC Algorithms 16. A Catalog of Parameter Sets for Standards 17. An Implementation of the Model Algorithm 18. Roll Your Own Table-Driven Implementation 19. Generating A Lookup Table 20. Summary 21. Corrections A. Glossary B. References C. References I Have Detected But Haven't Yet Sighted I can e-mail to you if you can't get from FTP site, it is 91K in length. -- For information on any of the following check out my WEB site at: http://www.usachoice.net/bpaddock Chemical Free Air Conditioning/No CFC's, Chronic Pain Relief, Electromedicine, Electronics, Explore!, Free Energy, Full Disclosure, KeelyNet, Matric Limited, Neurophone, Oil City PA, Philadelphia Experiment. - -- Author: Bob Paddock