Zakładka z wyszukiwarką danych komponentów
Selected language     Polish  ▼

Delete All
ON OFF
ALLDATASHEET.PL

X  

Preview PDF Download HTML

CFA631 Dane(HTML) 68 Page - Crystalfontz America, Inc.

Numer części CFA631
Szczegółowy opis  INTELLIGENT DISPLAY MODULE
Pobierz  81 Pages
Scroll/Zoom Zoom In 100% Zoom Out
Producent  CRYSTAIFONTZ [Crystalfontz America, Inc.]
Strona internetowa  https://www.crystalfontz.com/
Logo 

CFA631 Datasheet(Arkusz danych) 68 Page - Crystalfontz America, Inc.

Zoom Inzoom in Zoom Outzoom out
 68 / 81 page
background image
Crystalfontz
Data Sheet Release 2014-11-17
www.crystalfontz.com
CFA631 Intelligent Display Modules
Page 68
Algorithm 2: “C” Bit Shift Implementation
This algorithm was mainly written to avoid any possible legal issues about the source of the routine (at the request of the
LCDproc group). This routine was “clean” coded from the definition of the CRC. It is ostensibly smaller than the table
driven approach but will take longer to execute. This routine is offered under the GPL.
typedef unsigned char ubyte;
typedef unsigned short word;
word get_crc(ubyte *bufptr,word len)
{
register unsigned int
newCRC;
//Put the current byte in here.
ubyte
data;
int
bit_count;
//This seed makes the output of this shift based algorithm match
//the table based algorithm. The center 16 bits of the 32-bit
//"newCRC" are used for the CRC. The MSb of the lower byte is used
//to see what bit was shifted out of the center 16 bit CRC
//accumulator ("carry flag analog");
newCRC=0x00F32100;
while(len--)
{
//Get the next byte in the stream.
data=*bufptr++;
//Push this byte’s bits through a software
//implementation of a hardware shift & xor.
for(bit_count=0;bit_count<=7;bit_count++)
{
//Shift the CRC accumulator
newCRC>>=1;
//The new MSB of the CRC accumulator comes
//from the LSB of the current data byte.
if(data&0x01)
newCRC|=0x00800000;
//If the low bit of the current CRC accumulator was set
//before the shift, then we need to XOR the accumulator
//with the polynomial (center 16 bits of 0x00840800)
if(newCRC&0x00000080)
newCRC^=0x00840800;
//Shift the data byte to put the next bit of the stream
//into position 0.
data>>=1;
}
}
//All the data has been done. Do 16 more bits of 0 data.
for(bit_count=0;bit_count<=15;bit_count++)
{
//Shift the CRC accumulator
newCRC>>=1;
//If the low bit of the current CRC accumulator was set
//before the shift we need to XOR the accumulator with
//0x00840800.
if(newCRC&0x00000080)
newCRC^=0x00840800;
}
//Return the center 16 bits, making this CRC match the one’s
//complement that is sent in the packet.
return((~newCRC)>>8);
}


Html Pages

1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81 


Datasheet Download




Link URL




Privacy Policy
ALLDATASHEET.PL
Czy Alldatasheet okazała się pomocna?  [ DONATE ]  

O Alldatasheet   |   Reklama   |   Kontakt   |   Polityka prywatności   |   Dodaj do ulubionych   |   Linki   |   Lista producentów
All Rights Reserved© Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn