byte[] tem_data = new byte[8];
byte[] cumulant = new byte[22] { 0x54, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x40, 0xDC, 0x16 };
int sum = 0;
cumulant[20] = 0;
for (int i = 0; i < 20; i++)
{
sum += cumulant[i];
cumulant[20] += cumulant[i];//方法1,这里只取低8位
}
tem_data = BitConverter.GetBytes(short.Parse(sum.ToString()));//方法2,转换成2个字节,低地址存放低位,方法数组中
如代码中方法二所示,tem_data[0]=0xDC、tem_data[1]=0x01