39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
namespace ASTM_D7896_Tester.Services;
|
||
|
||
public interface IPlcService
|
||
{
|
||
Task<bool> ConnectAsync();
|
||
Task DisconnectAsync();
|
||
Task<bool> IsConnectedAsync();
|
||
/// <summary> 读取指定工位的压力(浮点数) </summary>
|
||
/// <param name="stationId">工位号 1~3</param>
|
||
//Task<float> ReadPressureAsync(int stationId);
|
||
|
||
/// <summary> 读取湿膜流量(浮点数) </summary>
|
||
Task<float> ReadWetFlowAsync(int stationId);
|
||
|
||
/// <summary> 读取干膜流量(浮点数) </summary>
|
||
Task<float> ReadDryFlowAsync(int stationId);
|
||
|
||
/// <summary> 写入线圈(如 M 元件) </summary>
|
||
Task WriteCoilAsync(ushort coilAddress, bool value);
|
||
|
||
/// <summary> 写入单个寄存器(16位) </summary>
|
||
Task WriteRegisterAsync(ushort registerAddress, ushort value);
|
||
|
||
/// <summary> 读取线圈状态(如 M 元件的 ON/OFF) </summary>
|
||
Task<bool> ReadCoilAsync(ushort coilAddress);
|
||
|
||
/// <summary> 读取连续多个保持寄存器(16位) </summary>
|
||
Task<ushort[]> ReadHoldingRegistersAsync(ushort startAddress, ushort count);
|
||
|
||
/// <summary> 写入单个保持寄存器(16位) </summary>
|
||
Task WriteSingleRegisterAsync(ushort registerAddress, ushort value);
|
||
|
||
|
||
Task WriteMultipleRegistersAsync(ushort registerAddress, float value);
|
||
|
||
float UshortToFloat(ushort P1, ushort P2);
|
||
|
||
Task<float> ReadFloatAsync(ushort startAddress);
|
||
} |