Innovenergy_trunk/csharp/lib/Battery48TL/Program.cs

33 lines
1013 B
C#

using InnovEnergy.Lib.Protocols.Modbus.Clients;
using InnovEnergy.Lib.Protocols.Modbus.Connections;
namespace InnovEnergy.Lib.Battery48TL;
public static class Program
{
public static void Main(String[] args)
{
// var connection = new ModbusSerialConnection("/dev/virtualcom0",
// 115200,
// Parity.Odd,
// 8,
// StopBits.One,
// TimeSpan.FromMilliseconds(500));
var connection = new ModbusTcpConnection("10.2.2.206", 8080);
var client = new ModbusRtuClient(connection, 2);
var device = new Battery48TlDevice(client);
while (true)
{
var s = device.ReadBatteryStatus();
Console.WriteLine(s);
Thread.Sleep(2000);
}
}
}