class Program
{
static void Main(string[] args)
{
//int i = 11;
//int b = (i & 0xf0);
//byte temp = 0x86;
//var h = temp & 0xf0;
//Console.WriteLine("{0}", i);
//Console.ReadKey();
ushort buf = 0xf1f0;
var cmd = (cmd)((buf & 0xff00) >> 8);
var data = buf & 0x00ff;
}
enum cmd : byte
{
send = 0xf0,
recv = 0xf1,
}
}
cmd 为控制命令, 取高8位
data 为数据, 低8位
这样控制 I/O 就方便了