Giter VIP home page Giter VIP logo

easymodbustcp.java's People

Contributors

rossmann-engineering avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easymodbustcp.java's Issues

Unit ID (slave id)

Hello,

is there is some possibility to change Unit ID (slave ID) of Modbus TCP device ?
I use ModbusClient in Java and device only response on 255 Slave ID (but, i see from code that easymodbus have set 1)

Thank you

UnitId byte datatyp is too small in java

Hi,

the unitIdentifier is a byte. In Java the byte datatyp is from -128 to 127 which means you can't address devices with a unitId above 127.
It worked with a device with unitId=32.

Cannot read double values with ModbusClient

Good morning,

checking in the source code of ModbusClient, I found that the method named ConvertRegistersToDouble has a different behaviour from what its name suggests.

The first thing I expected from this method was a double return type, but the return type is int. I don't understand how to manage this value to obtain the expected double value.
The second strange thing is that, as double values are represented by 64 bits, to read the bits that composes the value I will read 4 registers from the modbus server. But the method allow only an int[] input with length = 2 (otherwise it throws an exception).

Reading from the online documentation here http://easymodbustcp.net/java-modbusclient-methods, it seems that the correct behavior is read 2 registers and obtain an int as response (see the method in the list, there's an example).

Can you please explain the correct way to use this method and, if with this method isn't possible, if there's another way to use ModbusClient to read 4 registers and convert it to a double value?

Thanks in advance,
Regards

Sending simple message with example

Hello, I'm having trouble reading an input register (0x0758) using modbus from a Slave. I tried to implement the examples provided but I don't know if I'm doing it right as the value returned is not the expected... . Could you please point me in the right direction?

package com.test.modbus.main;

import de.re.easymodbus.modbusclient.ModbusClient;

public class Main {
	
	public static String SLAVE_ADDR = "xx.xx.xx.xx";

	
	public static void main(String[] args) {
		
		
		
		ModbusClient modbusClient = new ModbusClient(SLAVE_ADDR,502);
		try
		{
			modbusClient.Connect();
			int value = modbusClient.ReadInputRegisters(Integer.decode("0x0758"), 1)[0];
			System.out.println("Value at 0x0758: " + value);

		}
		catch (Exception e)
		{		
			System.out.println(e);
		}	
	}

}

It gives me Quantity invalid. I need to retrieve the value and then convert it to float but I'm a little bit lost

Connect does not Timeout

I have written a small java program which connects to a modbus server and reads Coils ok. When I run my code and the modbus device is not online it seems to wait indefinately and does not timeout. I have experimented with the setConnectionTimeout option but it does not seem to make any difference. Any ideas ?

Avoid Sysout

In all te constructors of ModbusClient four lines are output to stdout. I am using ModbusClient to periotically read values from my PV inverter, every 5 seconds. Hence my stdout log is becoming pretty big.

Would you mind, giving an option to shut up this output?

A related question: Is it by any means problematic to reuse a single instance of a ModbusClient for the whole lifetime of the application? It doesn't need to be thread safe (is it?). But bit would need to be completely reusable and hence stateless apart from what I passed into the constructor. In that case I would be ok with the four lines of output.

Shifted Value

Hiii,
I just started with using the EasyModbusTCP library in Java,
I tried to read some data from a device using this protocol, and it worked fine except some values where shifted in the registers, here is an example of output:

656d 732e 636d 2e74 6e00 ffffc0a8 232f
as you can see in the 6th register the 'ffff' values weren't supposed to be there,
I tried to read the values with another lib in python and it work fine, so I am sure that the problem is in the client.
Can anyone help me

Too many threads

Hello.
Every client connection to Easy Modbus Server a new thread is created, but at the disconnect it didn't kills. If we have 1k connect-disconnect we have a 1k threads.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.