communication with other devicesappendix cC-12
CRC Information.
The 8-bit CRC is generated using the following algorithm:
const uchar CPIP_crc_table[]=
{
0x00, 0xcd, 0xd9, 0x14, 0x, 0x3c, 0x28, 0xe5,
0xal, 0x6c, 0x78, 0xb5, 0x50, 0x9d, 0x89, 0x44
};
unsigned char CPIP_crc(uchar *start_adr, int count)
{
int i;
uchar crc,idx;
uchar *byte_ptr;
byte_ptr = start_adr ;
crc=0 ;
for (i=0; i<count ; i++)
{
idx=(crc^(*byte_ptr) ) & 0x0f;
crc=( (crc>>4) & 0x0f)^CPIP_crc_table[idx];
idx=(crc^( *byte_ptr >>4)) & 0xf;
crc=((crc >>4)&0xf)^CPIP_crc_table[idx];
++byte_ptr;
}
return(crc);
}
The start_adr indicates the starting address of the packet (should be pointing to the
0x02 STX value). The count indicates how many bytes, and should include the count
of all parts of the packet up to but not including the CRC eld. The function returns
the CRC value, which should be converted to a two-character hex-encoded ASCII
value for inclusion in the packet.
Analyte Data Information.
When the system sends an analyte data packet while in Operate mode, the data por-
tion of the packet will be of a specic format:
HH:MM:SS<tab>AABCD..D<tab>AABCD..D<tab>...<tab>
The entire analyte packet is in ASCII, and elds are tab-delimited. The rst eld indi-
cates the time in military format that the data was recorded on the CDI System 550.
Data is recorded every 6 seconds in the CDI System 550, so it is possible to get the
same record more than once if requesting a packet "<" every 6 seconds.
The analyte information follows, using the following notation: