I've found a fair amount of information about CRC for DTC/DTE communications.
Most of it is written in C or C+. The below psuedo code creates a look up
table. The help file makes it easy to find corresponding PB data types, but I'm
not familiar enough with C syntax to get anything more from this code than it looks
like two "FOR/NEXT" loops (and I'm not real sure about that). If someone could
translate this to PowerBASIC syntax I would very much appreciate it.
unsigned short a = 0
unsigned short b[256]={0}
unsigned short c[8] = {0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008}
{
int d, e, f
for (d=0; d<256; d++)
{
for (b[d]=0, f = 0x0000, e=0; e<8; e++)
{
if(d & f)b[d]^=c[e];
f<<=1;
}
}
a=0;
Return 0;
}
------------------
Mark Pruitt
[email protected]
[This message has been edited by mark pruitt (edited June 11, 2003).]
Most of it is written in C or C+. The below psuedo code creates a look up
table. The help file makes it easy to find corresponding PB data types, but I'm
not familiar enough with C syntax to get anything more from this code than it looks
like two "FOR/NEXT" loops (and I'm not real sure about that). If someone could
translate this to PowerBASIC syntax I would very much appreciate it.
unsigned short a = 0
unsigned short b[256]={0}
unsigned short c[8] = {0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008}
{
int d, e, f
for (d=0; d<256; d++)
{
for (b[d]=0, f = 0x0000, e=0; e<8; e++)
{
if(d & f)b[d]^=c[e];
f<<=1;
}
}
a=0;
Return 0;
}
------------------
Mark Pruitt
[email protected]
[This message has been edited by mark pruitt (edited June 11, 2003).]
Comment