示例#1
0
 public void SetRegsLONG(UInt32 data, int index)
 {
     UInt32[] in_reg  = new UInt32[1];;
     byte[]   in_data = new byte[4];
     in_reg[0] = data;
     Buffer.BlockCopy(in_reg, 0, in_data, 0, 4);
     Modbus.memrevercy(in_data, 4);
     Buffer.BlockCopy(in_data, 0, registerBuf, index * 2, 4);
 }
示例#2
0
 public UInt32 GetRegsLONG(int index)
 {
     UInt32[] in_reg  = new UInt32[1];
     byte[]   in_data = new byte[4];
     Buffer.BlockCopy(registerBuf, index * 2, in_data, 0, 4);
     Modbus.memrevercy(in_data, 4);
     Buffer.BlockCopy(in_data, 0, in_reg, 0, 4);
     return(in_reg[0]);
 }
示例#3
0
 public void SetRegsSHORT(ushort data, int index)
 {
     ushort[] in_reg  = new ushort[1];
     byte[]   in_data = new byte[2];
     in_reg[0] = data;
     Buffer.BlockCopy(in_reg, 0, in_data, 0, 2);
     Modbus.memrevercy(in_data, 2);
     Buffer.BlockCopy(in_data, 0, registerBuf, index * 2, 2);
 }
示例#4
0
 public ushort GetRegsSHORT(int index)
 {
     ushort[] in_reg  = new ushort[1];
     byte[]   in_data = new byte[2];
     Buffer.BlockCopy(registerBuf, index * 2, in_data, 0, 2);
     Modbus.memrevercy(in_data, 2);
     Buffer.BlockCopy(in_data, 0, in_reg, 0, 2);
     return(in_reg[0]);
 }
示例#5
0
 public void SetRegsFLOAT(float data, int index)
 {
     float[] in_reg  = new float[1];;
     byte[]  in_data = new byte[4];
     in_reg[0] = data;
     Buffer.BlockCopy(in_reg, 0, in_data, 0, 4);
     Modbus.memrevercy(in_data, 4);
     Buffer.BlockCopy(in_data, 0, registerBuf, index * 2, 4);
 }
示例#6
0
 public float GetRegsFLOAT(int index)
 {
     float[] in_reg  = new float[1];
     byte[]  in_data = new byte[4];
     Buffer.BlockCopy(registerBuf, index * 2, in_data, 0, 4);
     Modbus.memrevercy(in_data, 4);
     Buffer.BlockCopy(in_data, 0, in_reg, 0, 4);
     return(in_reg[0]);
 }