FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
454 views 3 comments
by anonymous

Hi,

In the documentation for the Modbus Gateway: https://community.teltonika-networks.com/?qa=blob&qa_blobid=4208100263841122966 it looks like the only type of registers to read/write to are holding registers.

If I change the function from 3 (read holding registers) to 4 (read input registers) I get the following error:

ERROR: INVALID REQUEST

Is it not possible to read input registers using this solution?

1 Answer

0 votes
by anonymous
Hi,

These are values that you can set into registers within Modbus. https://wiki.teltonika-networks.com/view/RUT955_Modbus#Set_Parameters

So before using Modbus, you can read what you do with it in this wiki, where we update it once anything changes:

https://wiki.teltonika-networks.com/view/RUT955_Modbus#Summary

EB.
by anonymous
Sorry if I was not completely clear and/or confused the names of things.

It is not the slave in the RUT that I need to read from. But from another Modbus TCP slave.

I need to be able to send function 4 requests (input register) over the MQTT Gateway solution.

The documentation https://wiki.teltonika-networks.com/view/RUT955_Modbus#MQTT_Gateway does however clearly state that there is only support for function 3, 6 and 16 so I guess I am out of luck.
by anonymous
Yes, you're right, only functions 3,6 and 16 are supported at this very moment, any other functions will not be requested correctly.

EB.
by anonymous

OK.

Isn't the format for function 4 the same as for function 3? The only difference is the id (3 or 4) for the call?

Modbus Read Holding Registers (03)

Modbus Read Holding Registers, function code 03, reads between 1 and 125 holding registers from the PLC.

The request PDU consists of 5 bytes:

Offset Length Description Values
0 Byte Function Code 03
2 Word First input address 0000h - FFFFh
4 Word Register count 0001 - 007Dh

 

Modbus Read Input Registers (04)

Modbus Read Input Registers, function code 04, reads between 1 and 125 input registers from the PLC.

The request PDU consists of 5 bytes:

Offset Length Description Values
0 Byte Function Code 04
2 Word First input address 0000h - FFFFh
4 Word Register count 0001 - 007Dh
Thus support should be extremely trivial to add? Especially since I expect that the code simply checks against the request function 3, 6 and 16 when choosing what action to take.