Industrial Components
Connect Delphi, C++Builder and .NET applications to PLCs, SCADA servers, energy meters, drives and serial devices: Modbus TCP and RTU, client and server, an OPC UA client and a serial port for RS-232 and RS-485.
New
Connect Delphi, C++Builder and .NET applications to PLCs, SCADA servers, energy meters, drives and serial devices: Modbus TCP and RTU, client and server, an OPC UA client and a serial port for RS-232 and RS-485.
New
One pack for the field level: the protocols that PLCs, meters and drives speak, in the same component style as the rest of sgcWebSockets.
TsgcSerialPort opens RS-232 and RS-485 ports on Windows, Linux and macOS, writes data and receives it in an event or with blocking reads. It is also the transport of the Modbus RTU components.
TsgcModbusTCPClient and TsgcModbusRTUClient read and write coils and registers over TCP/IP or a serial line, with typed helpers for 32-bit values and strings.
TsgcModbusTCPServer and TsgcModbusRTUServer turn your application into a Modbus device that answers from a thread-safe TsgcModbusDataModel, with events to check every read and write.
TsgcOPCUAClient connects to OPC UA servers over opc.tcp with signed and encrypted security policies, browses the address space, reads, writes, calls methods and subscribes to data changes and events.
Everything you need to read, write and serve plant data from your own applications.
Every Modbus request is a blocking call that returns the values or raises a clear exception, so reading a PLC looks like reading a local variable. The components handle framing, transaction ids, CRC checks, timeouts and retries for you.
Connect a Modbus TCP client, read ten holding registers and write one. The same code works against any Modbus TCP device or gateway.
uses
sgcIndustrial;
procedure TForm1.ReadPLC;
var
vRegisters: TsgcModbusRegisters;
begin
FClient := TsgcModbusTCPClient.Create(Self);
FClient.Host := '192.168.1.50';
FClient.Port := 502;
FClient.UnitId := 1;
FClient.OnError := OnModbusError;
FClient.Active := True;
if FClient.Active then
begin
// holding registers 0..9 (40001..40010 in many device manuals)
vRegisters := FClient.ReadHoldingRegisters(0, 10);
Memo1.Lines.Add(Format('Register 0 = %d', [vRegisters[0]]));
FClient.WriteSingleRegister(100, 1234);
end;
end;
procedure TForm1.OnModbusError(Sender: TObject; const aError: string);
begin
Memo1.Lines.Add('Error: ' + aError);
end;
#include "sgcIndustrial.hpp"
void __fastcall TForm1::ReadPLC()
{
FClient = new TsgcModbusTCPClient(this);
FClient->Host = "192.168.1.50"; // Port is 502 by default
FClient->UnitId = 1;
FClient->OnError = OnModbusError;
FClient->Active = true;
if (FClient->Active)
{
// holding registers 0..9 (40001..40010 in many device manuals)
TsgcModbusRegisters vRegisters = FClient->ReadHoldingRegisters(0, 10);
Memo1->Lines->Add("Register 0 = " + IntToStr(vRegisters[0]));
FClient->WriteSingleRegister(100, 1234);
}
}
void __fastcall TForm1::OnModbusError(TObject *Sender, const String aError)
{
Memo1->Lines->Add("Error: " + aError);
}
using System;
using esegece.sgcWebSockets;
class PlcReader
{
TsgcModbusTCPClient FClient = new TsgcModbusTCPClient();
public void ReadPLC()
{
FClient.Host = "192.168.1.50";
FClient.Port = 502;
FClient.UnitId = 1;
FClient.OnError += OnModbusError;
FClient.Active = true;
if (FClient.Active)
{
// holding registers 0..9 (40001..40010 in many device manuals)
ushort[] vRegisters = FClient.ReadHoldingRegisters(0, 10);
Console.WriteLine("Register 0 = " + vRegisters[0]);
FClient.WriteSingleRegister(100, 1234);
}
}
void OnModbusError(object Sender, string aError)
{
Console.WriteLine("Error: " + aError);
}
}
Written technical documents for every component, covering configuration, the properties and events you will use, and complete working code. Each one is also published as a PDF.