plc4x-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cesar Garcia <cesar.gar...@ceos.com.ve>
Subject Re: [Modbus] Querying Values from Holding Register
Date Wed, 20 May 2020 14:49:47 GMT
Hi.

In this branch you can find the modifications to the Modbus 0.6.0 driver to
read scalar types from the same requested field.

https://github.com/glcj/plc4x/tree/s7alarm

In the future we must follow the new driver model 0.7.0

I hope it is useful for you,

Best regards,


El mié., 20 may. 2020 a las 6:52, udeho (<udeho@student.kit.edu>) escribió:

> Hi Chris,
>
> yes, I use the 0.6.0 version.
> Great, I will try to do it again when the new version is available and let
> you know whether it works.
> Thank you very much!
>
> Best
> Tim
>
> -----Original Message-----
> From: Christofer Dutz <christofer.dutz@c-ware.de>
> Sent: Mittwoch, 20. Mai 2020 11:28
> To: dev@plc4x.apache.org
> Subject: Re: [Modbus] Querying Values from Holding Register
>
> Hi Tim,
>
> I guess you are using one of the "old generation" drivers (As you say it's
> working and the address seems to imply that).
> Perhaps you should either try the version 0.8.0-SNAPSHOT or wait for 2
> more days till we release the 0.7.0 version.
>
> In the 0.7.0 version we have completely deleted all existing drivers and
> replaced them by new ones.
> While at it I took the liberty of making the Modbus a little more robust.
>
> So it would be great if you could give us feedback if your problem goes
> away magically when updating to these driver versions.
>
> Chris
>
>
>
> Am 20.05.20, 10:24 schrieb "udeho" <udeho@student.kit.edu>:
>
>     Hi all,
>
>     I have tried to query values from the holding register of a simulated
> modbus device and process them as integer using the following code:
>     // read integer / holding register
>                         PlcDriverManager driverManager = new
> PlcDriverManager();
>                         String conString = "modbus:tcp://localhost";
>                         PlcConnection plcCon =
> driverManager.getConnection(conString);
>                         PlcReadRequest.Builder builder =
> plcCon.readRequestBuilder();
>                         builder.addItem("value", "readholdingregisters:1");
>                         PlcReadRequest readRequest = builder.build();
>                         PlcReadResponse resp = readRequest.execute().get();
>
>     This runs well, but when I try to handle the result as integer (using
> resp.getInteger("value")) I always get null as result no matter what's in
> the register.
>     For Boolean values in the coil this works without any problem (using
> getBoolean() of course).
>     Another approach I tried is using the getAllByteArrays("value");
> command, but I haven't found a way to get the returned collection of byte
> arrays into integers.
>
>     Can you give me an indication of what my problem may be or what I'm
> doing wrong?
>
>     Thank you very much in advance!
>
>     Best
>     Tim
>
>

-- 
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*

*Cel: +58 414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automation@siemens.com
<support.aan.automation@siemens.com>*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message