添加项目文件。
This commit is contained in:
28
BenchMovementModule/HardwareDrive/GantryControlRtu.cs
Normal file
28
BenchMovementModule/HardwareDrive/GantryControlRtu.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using DeviceCommand.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BenchMovementModule.HardwareDrive
|
||||
{
|
||||
public class GantryControlRtu : GantryControlBase
|
||||
{
|
||||
// 暴露出底层的 ModbusRtu 实例以便修改串口配置
|
||||
public ModbusRtu RtuDevice => (ModbusRtu)_device;
|
||||
|
||||
public GantryControlRtu(string portName, int baudRate = 9600, byte slaveAddress = 1)
|
||||
: base(new ModbusRtu(), slaveAddress)
|
||||
{
|
||||
RtuDevice.ConfigureDevice(portName, baudRate);
|
||||
}
|
||||
|
||||
public GantryControlRtu(string portName, int baudRate, int dataBits, StopBits stopBits, Parity parity, byte slaveAddress = 1)
|
||||
: base(new ModbusRtu(), slaveAddress)
|
||||
{
|
||||
RtuDevice.ConfigureDevice(portName, baudRate, dataBits, stopBits, parity);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user