将2位十进制数字转成BCD码
2019-12-16 本文已影响0人
MarlonWang
public static byte FromBCD(int vals)
{
byte b = 0;
if (vals > 99 || vals < 0)
{
return b;
}
int shi = vals / 10;
int ge = vals % 10;
int valsNew = shi * 16 + ge;
b = (Byte)valsNew;
return b;
}