C# Modbus Slavexception Reading RegistryC#

Ein Treffpunkt für C#-Programmierer
Guest
 C# Modbus Slavexception Reading Registry

Post by Guest »

Ich arbeite an einem C# -Projekt, das von TCP Modbus mit SPS zusammenkommen muss. Registrierung über 12000.
Ich bekomme diese Ausnahme: < /p>

Exception 'Modbus.SlaveException' Function Code: 131
< /code>

Dies ist der Teil des Codes, der die Ausnahme generiert: < /p>

private TcpClient tcpClient;
private ModbusIpMaster master;
private void connect(){
// connect to Modbus TCP Server
string ipAddress = "192.168.77.7"; //Input WISE IP
int tcpPort = 502;
tcpClient = new TcpClient(ipAddress, tcpPort);

// create Modbus TCP Master by the tcp client
master = ModbusIpMaster.CreateIp(tcpClient);

// rewrite the value of AO ch0 (40020~40021) by float
byte slaveID = 1;
// ushort rewriteAddress = 20;
// ushort[] rewriteValue = new ushort[2] { 0, 0 };
// float[] floatData = new float[1] { 223.456F };
// Buffer.BlockCopy(floatData, 0, rewriteValue, 0, 4);
Random random = new Random();

// read the holding register 12001~12005
// write the holding register 301~305

ushort startAddress = 12000;
ushort numOfPoints = 5;
master.Transport.ReadTimeout = 1000;
while (!_shouldStop1)
{
try
{
ushort[] register = master.ReadHoldingRegisters(slaveID, startAddress, numOfPoints);

for (int index = 0; index

Jeder Vorschlag wird geschätzt.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post
  • PHP Reading Shell_exec Live -Ausgabe
    by Anonymous » » in Php
    0 Replies
    12 Views
    Last post by Anonymous
  • Regex - Python Reading Strings aus einem Listenindexfehler
    by Anonymous » » in Python
    0 Replies
    1 Views
    Last post by Anonymous
  • Lesen verschiedener Datentypen über Modbus RTU auf ESP32
    by Guest » » in C++
    0 Replies
    11 Views
    Last post by Guest
  • Modbus.net tcpclient schlägt genau alle 6. Umfrage aus
    by Guest » » in C#
    0 Replies
    17 Views
    Last post by Guest
  • Veröffentlichen Sie Java in GitHub Paket Registry mit Readme.md [Duplicate]
    by Anonymous » » in Java
    0 Replies
    11 Views
    Last post by Anonymous