想要将c# 32位浮点数拆成两个16位ushort类型写进西门子plc内部,但不知该如何在C#中写方法
float f = 123.456f;byte[] b = BitConverter.GetBytes(f);ushort us1, us2;us1 = (uint)b[0] + (uint)b[1] * 256;us2 = (uint)b[2] + (uint)b[3] * 256;
写的很好