Showing results for 
Search instead for 
Did you mean: 

Modbus TCP and Beckhoff BK9100 Register/Adress of IO/DO

Go to solution



i have read this Thread and it helped a little bit, because at the beginning there is the same problem.

The problem is that i try to set DO but it didnt work.

I use the Ni Modbus Libary and the MB Ethernet Master and Slave Example. I have communication if i write the IP in the box because COM lamp is blinking. But i dont know what registers i have to write. Where do i find out what register/adress my DO have. I dont understand how to adress the DO. I know its a basic knowdledge but i dont get it and its driving me crazy.


Iam glad for any help



0 Kudos
Message 1 of 6

@mrgigi wrote:
Where do i find out what register/adress my DO have.  

Usually, DOs are not treated as registers, but as coils, and you need to call the Write Coils function. To find the address you will need to look at the documentation of the device, but if it's coils, it usually starts from 1.


Some devices also map DI/DOs to registers (sometimes packing 16 DIs in one 16 bit register), but you should go with the coil functions.

Try to take over the world!
Message 2 of 6

Thanks a lot!


Over the days i have tried a lot of other ways but i still have connection (so the COM led is blinking) but nothingelse happens. 

This is my example which iam using. 

I have also tried to write a single coil by using software like Modsak but i still have only communication but no statusled is blinking if iam writing a coil.


I really dont know what iam doing wrong.


0 Kudos
Message 3 of 6

I don't know the device you're using, so I certainly can't say what's wrong. Like I said, you need to start with the documentation for the device and find the addresses for the relevant parts. Is it really 0x1120? Is that supposed to be coils or registers? Look that up.


If it doesn't work with an external program it likely means you're configuring or connecting something incorrectly. You might need to contact Beckhoff for support.


Some other comments about what you're doing, which are probably not a real problem, but which you should be aware of:


  1. You're setting the amount of registers to write to 1, but you give two registers. I haven't looked inside them, but I'm guessing the NI VIs actually ignore the count value for write operation and just check the size of the array.
  2. You have values in the data array for the read command. This also doesn't make sense.
  3. Be careful with changing the index display on arrays. It's better to generally leave it at 0 and expand the array to show all the elements (plus an empty one so that you know you're looking at the full array).



Try to take over the world!
Message 4 of 6

A few other comments:


  1. Modbus is a command-response protocol. If you're not getting errors in the error wires (you should have indicators or probes to verify), it probably means the communication is OK and you're getting a response. You can also try probing inside the VIs to see that you're getting the response.
  2. That Modbus library should have wrapper VIs for the different operations. You should probably use those instead of the main VI.
  3. There is also a newer Modbus library from NI which you can find in VIPM, as well as other Modbus toolkits. This won't change whether things work or not, but those toolkits are newer. The newer one from NI, at least the last time I looked at it, had locked blocked diagrams.
  4. Assuming your address is correct, make sure it's also in the correct representation (i.e. that it's 1120 hex, as opposed to 1120 decimal).
  5. If all else fails, you can try writing code which will run through all the addresses and see at which point it has an impact.

Try to take over the world!
Message 5 of 6
Accepted by topic author mrgigi



thanks a lot for your help and advice.


I solved the problem by changing the output Terminal.




0 Kudos
Message 6 of 6