This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Modbus TCP connection datakom d-200 mk2
#1
Good day!

There is an unclear problem with the Modbus TCP connection. The controller has restrictions on the number of registers requested at a time (no more than 16), and the controller can only process group requests for reading registers, the function read single registers is not supported. in this regard, I use the program code and not the modbus profiles.

Faced a very strange problem. Initially, I checked by reading the modbus pull program, when using it, I can open and close the connection many times in a row and the controller works it out correctly, but when using a fairly standard code for the logic machine, the datakom controller stops responding after several requests and even to connect the modus pull program as well does not connect. What could be the reason, did anyone come across a similar one?

description of the modus protocol for the datakom d-200 mk2  controller: http://datakom.com.tr/upload/Files/500_MODBUS.pdf

example of code i am using:

Code:
require('luamodbus')
mb = luamodbus.tcp()
mb:open('10.36.0.25', 502)
--mb:setresponsetimeout(5)
if mb:connect() then
  log('connect')
  reg10240, reg10241, reg10242, reg10243, reg10244, reg10245, reg10246 = mb:readregisters(10240,7)
  if (reg10240 ~= nil) then log('Mains phase L1 voltage: '..reg10240) end
  if (reg10242 ~= nil) then log('Mains phase L2 voltage: '..reg10242) end
  if (reg10244 ~= nil) then log('Mains phase L3 voltage: '..reg10244) end
  if (reg10246 ~= nil) then log('Genset phase L1 voltage: '..reg10246) end
os.sleep(0.5)
  reg10338, reg10339, reg10340, reg10341 = mb:readregisters(10338,4)
  if (reg10338 ~= nil) then log('Mains frequency: '..reg10338) end
  if (reg10339 ~= nil) then log('Genset frequency: '..reg10339) end
  if (reg10341 ~= nil) then log('Battery voltage: '..reg10341) end   
  mb:close()
else
  log('read error reg10240...reg10246') 
end

mb:close()

To restore communication with the controller, only its power restart helps, reconnecting the etnernet line does not remove the problem
Reply


Messages In This Thread
Modbus TCP connection datakom d-200 mk2 - by m.j.sorokin - 21.02.2021, 13:07

Forum Jump: