unsigned long BCDtoDec(const unsigned char *bcd, int length)
{
int i, tmp;
unsigned long dec = 0;
for(i=0; i<length; i++)
{
tmp = ((bcd[i]>>4)&0x0F)*10 + (bcd[i]&0x0F);
dec += tmp * power(100, length-1-i);
}
return dec;
}
转成10进制比较大小,如果需要16进制输出,再转成16
温馨提示:答案为网友推荐,仅供参考