/// <summary>
/// 获取字 short WORD 上指定的位是否有效
/// </summary>
/// <param name="val"></param>
/// <param name="bit"></param>
/// <returns></returns>
public bool GetBitVal(ushort val, int bit) {
switch (bit) {
case 0:return (val & 0x00001)== 0x00001; break;
case 1: return (val & 0x00002) == 0x00002; break;
case 2: return (val & 0x00004) == 0x00004; break;
case 3: return (val & 0x00008) == 0x00008; break;
case 4: return (val & 0x00010) == 0x00010; break;
case 5: return (val & 0x00020) == 0x00020; break;
case 6: return (val & 0x00040) == 0x00040; break;
case 7: return (val & 0x00080) == 0x00080; break;
case 8: return (val & 0x00100) == 0x00100; break;
case 9: return (val & 0x00200) == 0x00200; break;
case 10: return (val & 0x00400) == 0x00400; break;
case 11: return (val & 0x00800) == 0x00800; break;
case 12: return (val & 0x01000) == 0x01000; break;
case 13: return (val & 0x02000) == 0x02000; break;
case 14: return (val & 0x04000) == 0x04000; break;
case 15: return (val & 0x08000) == 0x08000; break;
case 16: return (val & 0x10000) == 0x10000; break;
}
return false;
}