Forum Home › Forums › Communicating with Devices › Modbus › Write multiple modbus register FC=16
Tagged: modbus
- This topic has 17 replies, 4 voices, and was last updated 2 years, 7 months ago by manjey73.
-
AuthorPosts
-
January 11, 2021 at 10:10 am #7963ns.farizParticipant
Hi..
I try to write multiple holding register 4104 and 4105, each with different 16bits value. So I made command template like this picture below
Then I put a table to send command, but it’s only one command. How can I make 2 different value sent to each modbus register with single command? I need to write 35700 to modbus register 4104 and 29834 to modbus register 4105.
I hope you understand what I mean.
Thank you.
January 11, 2021 at 10:23 am #7967MikhailModeratorHi,
A user can input only one value in the command dialog. It’s possible to send 2 values using formulas. What is the meaning of this command for a user? Is it possible to simplify input for him? For example, a user just click “Execute” and the predefined values are sent to controller.
January 11, 2021 at 12:56 pm #7970ns.farizParticipantHi Mikhail,
User just klik a button, and pre-defined value send to modbus with write to multiple register 4104-4105 like I have explained in the previous post. What formula I can use? And where to put them? Do I need create another output channels?
January 12, 2021 at 2:12 pm #7984MikhailModeratorHi,
You need only one output channel. Set the Command Values field to “Execute”, set Command Type to Binary and enable Formula used.
Set the formula:
new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }
Check how it works, and what are the register values sent as a result. Copy here communication log, containing the command.
- This reply was modified 3 years, 2 months ago by Mikhail.
January 13, 2021 at 1:32 am #8001ns.farizParticipantHi,
Thank you for your reply. But could you explain to me about this syntax? Is it make array? but { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x07 } what is this number? It’s neither 35700 nor 29834 .
January 13, 2021 at 1:35 pm #8010MikhailModeratorHi,
This array is very useful to check byte order in the packet sent to the controller. After we check it, we can replace 1..8 to the specific values 35700 and 29834.
January 16, 2021 at 5:48 am #8039ns.farizParticipantHi,
I tried formula above. Please see line log below. `2021-01-16 14:46:09 Command to the Device 1 “Gen 1”, type: KpModbus
Command “Auto”
Send (17): 01 EF 00 00 00 0B 00 10 10 08 00 02 04 01 02 03 04
Receive (7/7): 01 EF 00 00 00 03 00
Receive (2/2): 90 02
Device error: [02] ILLEGAL DATA ADDRESS!
Command “Auto”
Send (17): 01 F0 00 00 00 0B 00 10 10 08 00 02 04 01 02 03 04
Receive (7/7): 01 F0 00 00 00 03 00
Receive (2/2): 90 02
Device error: [02] ILLEGAL DATA ADDRESS!
Command “Auto”
Send (17): 01 F1 00 00 00 0B 00 10 10 08 00 02 04 01 02 03 04
Receive (7/7): 01 F1 00 00 00 03 00
Receive (2/2): 90 02
Device error: [02] ILLEGAL DATA ADDRESS!`
What is that mean?
January 16, 2021 at 9:39 am #8040manjey73Participant00 Unit identifier 0x00 (0)
Specify in the database, in addition to the IP address, also the address for the RTU mode, if the device has the ability to poll on the 485 interface or just 1
January 17, 2021 at 8:28 am #8044MikhailModeratorUsing Modbus Parser that the sent value is 0x0102, 0x0304. So if you change these bytes in the formula to 0x8B, 0x74, 0x74 and 0x8A, you will get what you need.
And yes, may be you should set Modbus device ID (unit ID).
January 17, 2021 at 8:44 am #8049ns.farizParticipantHi,
I’m using modbus TCP. how can I set modbus device ID? I just set IP address and used to fine to read modbus register.
January 17, 2021 at 8:47 am #8050manjey73ParticipantSome devices may not respond if no ID is specified, even over TCP
January 18, 2021 at 9:44 am #8064MikhailModeratorHi,
how can I set modbus device ID?
Set the device address in the Devices table. After uploading the project, check logs.
January 19, 2021 at 9:16 am #8081ns.farizParticipantHi,
It’s work perfect. I set modbus command address for the same register. and set it on channel output for each command with different value.
But I have problem for making simple table. No value output even I have set up input channel in table. What’s wrong with my configuration? I can not find any error log which are related with input channel.
January 19, 2021 at 1:01 pm #8084MikhailModeratorHi,
It’s work perfect.
Good!
The new error is related to the installation of the web app. Please create a new topic to discuss it.
August 13, 2021 at 7:14 am #9405panggahParticipantHi Mikhail,
i have tried this method, but still can’t worked.
there are my line log.
can you help me? thanks2021-08-13 13:58:11 Command to the Device 1 “tes remote”, type: KpModbus, address: 10, call number: 10.13.118.19
Command “remoted”
Send (17): 00 D4 00 00 00 0B 0A 10 10 07 00 02 04 8B 74 74 8B
Receive (7/7): 00 D4 00 00 00 03 0A
Receive (2/2): 90 02
Device error: [02] ILLEGAL DATA ADDRESS!
Command “remoted”
Send (17): 00 D5 00 00 00 0B 0A 10 10 07 00 02 04 8B 74 74 8B
Receive (7/7): 00 D5 00 00 00 03 0A
Receive (2/2): 90 02
Device error: [02] ILLEGAL DATA ADDRESS!
Command “remoted”
Send (17): 00 D6 00 00 00 0B 0A 10 10 07 00 02 04 8B 74 74 8B
Receive (7/7): 00 D6 00 00 00 03 0A
Receive (2/2): 90 02
Device error: [02] ILLEGAL DATA ADDRESS! -
AuthorPosts
- You must be logged in to reply to this topic.