Skip to content

Getting started

Start here

Use this page when you want your first successful SLMP read from a MELSEC PLC. The recommended path is one explicit SlmpPlcProfile, one connected QueuedSlmpClient, and one safe D register.

Prerequisites

Requirement Value
.NET SDK .NET 9 SDK for the net9.0 target
Package PlcComm.Slmp
PLC endpoint 192.168.250.100:1025 over TCP
First profile to try SlmpPlcProfile.IqR when your PLC is iQ-R hardware
First read target D100

Install

dotnet add package PlcComm.Slmp

Choose your PLC profile

SlmpPlcProfile is the .NET selector for the canonical profile. It controls frame type, compatibility mode, string address rules, and device range rules. Pick the selector that matches your PLC hardware.

using PlcComm.Slmp;

var options = new SlmpConnectionOptions("192.168.250.100", SlmpPlcProfile.IqR)
{
    Port = 1025,
};

First read

using System;
using PlcComm.Slmp;

var options = new SlmpConnectionOptions("192.168.250.100", SlmpPlcProfile.IqR)
{
    Port = 1025,
};

await using var client = await SlmpClientFactory.OpenAndConnectAsync(options);
var value = await client.ReadTypedAsync("D100", "U");
Console.WriteLine($"D100 = {value}");

Expected output:

D100 = 0

The number depends on your PLC data. A successful run prints a numeric value and does not throw an SLMP end-code exception.

First write

Use only a test register that your PLC program allows you to change.

using System;
using PlcComm.Slmp;

var options = new SlmpConnectionOptions("192.168.250.100", SlmpPlcProfile.IqR)
{
    Port = 1025,
};

await using var client = await SlmpClientFactory.OpenAndConnectAsync(options);
await client.WriteTypedAsync("D100", "U", (ushort)123);
var value = await client.ReadTypedAsync("D100", "U");
Console.WriteLine($"D100 = {value}");

Confirm success

  1. Confirm the PLC is reachable at 192.168.250.100.
  2. Confirm TCP port 1025 is enabled for SLMP.
  3. Confirm SlmpPlcProfile.IqR matches your actual PLC hardware, or change it to the correct profile.
  4. Confirm D100 is a safe test register in your PLC program.
  5. Confirm the read prints a value before you run a write.

If it does not work

Symptom Check
Connection opens but every read returns an end code SlmpPlcProfile must match the actual PLC hardware. The profile selects frame type and access mode.
First register read fails Start with D word reads. Do not start with G, HG, LTN, or LCN.
Several callers share one connection Use QueuedSlmpClient, returned by SlmpClientFactory.OpenAndConnectAsync. Raw SlmpClient is not thread-safe for concurrent callers.
Long timer or long counter values look wrong See Gotchas before reading LTN, LSTN, LCN, or LZ.

Next pages

Page Link
Usage guide USAGE_GUIDE.md
Supported registers SUPPORTED_REGISTERS.md