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.

RS232 Communacation
#1
Hi Admin
I'm trying to integrate LM with generator to read 3 phase values , fuel level etc.
Code:
require('luamodbus')
mb = luamodbus.rtu()
res = mb:open('/dev/RS232', 9600, 'N', 8, 1, 'H')
log(res)
if res then
  mb:connect()
  mb:setslave(3)
  mb:setresponsetimeout(30)

    -- read 3-phase system voltage
  r1, r2 = mb:readregisters(10240, 2)
    
  if r1 and r2 then

    result = bit.lshift(r1, 16) + r2
    grp.checkwrite('32/5/1', result)
    log(result)
  end
 
end

mb:close()
I used this code to read registers LM opens port succesfully but no value writed at all.
I tried changing Rx - Tx pins already but helped not at all.
Any help would appreciated
Thanks

Attached Files
.pdf   500_MODBUS.pdf (Size: 838.77 KB / Downloads: 10)
Reply


Messages In This Thread
RS232 Communacation - by mkaymak - 25.05.2023, 12:36
RE: RS232 Communacation - by admin - 25.05.2023, 12:37
RE: RS232 Communacation - by mkaymak - 25.05.2023, 12:43
RE: RS232 Communacation - by admin - 25.05.2023, 12:50
RE: RS232 Communacation - by mkaymak - 25.05.2023, 14:48
RE: RS232 Communacation - by mkaymak - 26.05.2023, 12:48
RE: RS232 Communacation - by admin - 26.05.2023, 13:27
RE: RS232 Communacation - by mkaymak - 29.05.2023, 05:26
RE: RS232 Communacation - by admin - 29.05.2023, 08:26
RE: RS232 Communacation - by rw_echo - 26.07.2023, 10:07
RE: RS232 Communacation - by Daniel - 26.07.2023, 10:22
RE: RS232 Communacation - by rw_echo - 26.07.2023, 11:39

Forum Jump: