I found a C routine that calculates the CRC correctly OnCrctst() is a button to run it. I need a 8051 ASM routine to do the same thing or similar I can only find a few PIC routines which I cannot seen to follow. Please, someone help me..... Ed ============================================================================
#define P_KERMIT 0x8408 unsigned short update_crc_kermit(unsigned short crc, char c); static int crc_tabkermit_init = FALSE; static unsigned short crc_tabkermit[256]; static void init_crckermit_tab( void );
void CEfloppyDlg::OnCrctst() { int i, j; char ed[10]; unsigned char dstr[20];
dstr[0]=0x30; //known data string 02 30 30 30 33 46 4F 21 20 20 03 68 D5 dstr[1]=0x30; //02 is not processed for CRC dstr[2]=0x30; //03 is string end and is included dstr[3]=0x33; //68 D5 is CRC Kermit and does calculate correctly dstr[4]=0x46; //with this routine dstr[5]=0x4f; dstr[6]=0x21; dstr[7]=0x20; dstr[8]=0x20; dstr[9]=0x03; crc = 0x0000; for (i=0; i> 8) ^ crc_tabkermit[ tmp & 0xff ];
return crc; }
static void init_crckermit_tab( void ) { int i, j; unsigned short crc, c;
for (i=0; i 1 ) ^ P_KERMIT; else crc = crc >> 1; c = c >> 1; } crc_tabkermit[i] = crc; } crc_tabkermit_init = TRUE; }