Example #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);
 }
Example #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]);
 }
Example #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);
 }
Example #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]);
 }
Example #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);
 }
Example #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]);
 }