TRB140 Modbus TCP request problem

Hello,

I have set up a Modbus TCP request in Modbus Client, but I get a result that seems not logical (at least to me). The equipment sending the data is a 16 bit digital input converter, where inputs 1 to 10 are set to high, 11 to 16 are set to low.

If I set the answer to Hex, I get the following:

Request successful, result: "03FF"

If I set the answer to Bool, I get the following:

Request successful, result: [1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1]

Isn’t there here a problem? Why are the first two bits set to 1? Shouldn’t bits 7 and 8 be 1-s?

Edit: One more thing. The “bracket” option seems to work in “inverse” mode. If I set it on, I get no brackets, if I set it off, I get the brackets.

The software:

    Device:     TRB140
    Kernel:     5.4.251
    Firmware:   TRB1_R_00.07.05.4
    Build:      d48a3687a6
    Build date: 2023-11-07 15:44:58

Thanks,

Gabor

Hello,

Thank you for reaching out. Could you please try using a different data type in the TCP request configuration?

The “Brackets” option allows you to decide whether to include or exclude brackets in the Modbus response. If you turn it on, the brackets will be removed, and if you keep it off (the default setting), the brackets will be included in the response by default.

Thanks,
Mahmoud

Hello Mahmoud,

Sorry for the late reply. Here are the results:

HEX (register 141, 1 registers)
Request successful, result: "03FF"

16bit INT, high byte first (register 141, 1 registers)
Request successful, result: 1023

Bool (register 141, 1 registers)
Request successful, result: 1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1

Based on the above, I still think there is a bug in the firmware.

Regards,

Gabor

Hello gkovacs9999,

It appears there might be a misunderstanding in the interpretation of the datatype. It seems you are looking for the result in Binary Coded Decimal (BCD) format, rather than a Boolean conversion.

From the explanation you provided, it seems like you are expecting the following result:

Integer: 1023
BCD Result: 0001 0000 0010 0011

I want to clarify that the current capabilities do not support direct conversion to BCD format. However, if you are looking for a Boolean interpretation of the given binary sequence:

1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1

It suggests a non-zero value, and in many programming languages, this would be equivalent to true.

If you have any further questions or if there’s a specific aspect you’d like assistance with, please feel free to provide more details.

Best Regards,
Jerome

Hello Jerome,

I think what I get is a wrong result, in other words it is simply a bug.

The expected result for a “bool” answer would be simply:
Request successful, result: 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1

Which is the equivalent of 0b0000001111111111 or 0x03FF or 1023 in decimal. And as I wrote, I get these answers selecting 16 bit UINT (answer is 1023) or hex (answer is 0x03FF).

Regards,

Gabor

Hello @gkovacs9999,

In this case you are not requesting the data to be in Boolean form instead it should be converted from Integer (Decimal) to binary it shouldn’t be on Boolean form. Sad to say that this data type is not available yet with our device, but we will put it on our nice to have list.

Thanks

Regards,
Jerome

Hello,

Thanks for the answer. Still, I would like to know why do I get for a Bool request:

Request successful, result: 1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1

Is it a bug or not?

Regards,

Gabor

Hello,

it’s not a bug because this binary data type not available in the current firmware.

Thanks,
Mahmoud

Hello,

Sorry, what do you mean by “not available”?

Just look at the printscreens I have attached.



The same register (nr 141) is read as UINT16, as HEX and as BOOL (all of them “are available” in your firmware), and the result for the BOOL answer is not as expected (the bits are obviously in wrong order). In my opinion, this is clearly a bug.

Of course, you can call it whatever you want, but I suggest its is better to correct it.

Regards,

Gabor

This topic was automatically closed after 15 days. New replies are no longer allowed.