Beispiel #1
0
 public static void ReadScanData(PlcMaster master, ref byte[] data)
 {
     if (master == null)
     {
         return;
     }
     if (master.connected)
     {
         master.ReadHoldingRegister(100, 1, master.ScanStartAddress, 5, ref data);
     }
 }
Beispiel #2
0
 public static void ReadActiveReference(PlcMaster master, ref byte[] data)
 {
     if (master == null)
     {
         return;
     }
     if (master.connected)
     {
         master.ReadHoldingRegister(107, 1, master.ActiveReferenceStartAddress, 10, ref data);
     }
 }
Beispiel #3
0
 public static void ReadProductInUnloading(PlcMaster master, ref byte[] data)
 {
     if (master == null)
     {
         return;
     }
     if (master.connected)
     {
         master.ReadHoldingRegister(102, 1, master.UnloadingDataMatrixStartAddress, 20, ref data);
     }
 }
Beispiel #4
0
 public static void UpdateProductInLoadingStatus(PlcMaster master, ProductStatus productStatus)
 {
     byte[] dummy = { };
     if (master == null)
     {
         return;
     }
     if (master.connected)
     {
         master.WriteSingleRegister(1, 1, master.LoadingStateStartAddress, ModbusTcpHelper.WordArrayToByteArray(new[] { Convert.ToInt32(productStatus) }, 1), ref dummy);
     }
 }
Beispiel #5
0
 public static void WriteActiveReference(PlcMaster master, string reference)
 {
     if (master == null)
     {
         return;
     }
     if (master.connected)
     {
         var data = ModbusTcpHelper.AsciiStringToByteArray(reference);
         master.WriteMultipleRegister(106, 1, master.ActiveReferenceStartAddress, data, ref data);
     }
 }
Beispiel #6
0
 public static void WriteProductInUnloading(PlcMaster master, string dataMatrix)
 {
     if (master == null)
     {
         return;
     }
     if (master.connected)
     {
         var data = ModbusTcpHelper.AsciiStringToByteArray(dataMatrix);
         master.WriteMultipleRegister(105, 1, master.UnloadingDataMatrixStartAddress, data, ref data);
     }
 }
Beispiel #7
0
 public static void SetUniqueIdentityLength(PlcMaster master, int length)
 {
     byte[] dummy = { };
     if (master == null)
     {
         return;
     }
     if (master.connected)
     {
         master.WriteSingleRegister(5, 1, master.UniqueIdentityLengthAddress, ModbusTcpHelper.WordArrayToByteArray(new[] { length }, 1), ref dummy);
     }
 }
Beispiel #8
0
 public static void SetVirtualIndexer(PlcMaster master, VirtualIndexerStates virtualIndexer)
 {
     byte[] dummy = { };
     if (master == null)
     {
         return;
     }
     if (master.connected)
     {
         master.WriteSingleRegister(4, 1, master.VirtualIndexerStartAddress, ModbusTcpHelper.WordArrayToByteArray(new[] { Convert.ToInt32(virtualIndexer) }, 1), ref dummy);
     }
 }
Beispiel #9
0
 public static void SetTraceabilityStates(PlcMaster master, TraceabilityStates traceability)
 {
     byte[] dummy = { };
     if (master == null)
     {
         return;
     }
     if (master.connected)
     {
         master.WriteSingleRegister(3, 1, master.TraceabilityStateStartAddress, ModbusTcpHelper.WordArrayToByteArray(new[] { Convert.ToInt32(traceability) }, 1), ref dummy);
     }
 }