33 lines
889 B
C#
33 lines
889 B
C#
using DeviceCommand.Base;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DeviceCommand.Device
|
|
{
|
|
public class IOBoard:ModbusTcp
|
|
{
|
|
public IOBoard(string IpAddress, int port, int SendTimeout, int ReceiveTimeout)
|
|
{
|
|
ConfigureDevice(IpAddress, port, SendTimeout, ReceiveTimeout);
|
|
ConnectAsync();
|
|
}
|
|
public IOBoard()
|
|
{
|
|
ConnectAsync();
|
|
}
|
|
public async Task WriteOutput(byte slaveId, ushort startAddress, ushort value)
|
|
{
|
|
await WriteSingleRegisterAsync(slaveId, startAddress, value);
|
|
}
|
|
|
|
public async Task WriteOutputsBatch(byte slaveId, ushort startAddress, ushort[] values)
|
|
{
|
|
await WriteMultipleRegistersAsync(slaveId, startAddress, values);
|
|
}
|
|
|
|
}
|
|
}
|