![]() |
|
RS232 Communacation - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: RS232 Communacation (/showthread.php?tid=4787) |
RS232 Communacation - mkaymak - 25.05.2023 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 tried changing Rx - Tx pins already but helped not at all. Any help would appreciated Thanks RE: RS232 Communacation - admin - 25.05.2023 Use 'F' duplex instead of 'H' for RS232. RE: RS232 Communacation - mkaymak - 25.05.2023 Still no change,anything else RE: RS232 Communacation - admin - 25.05.2023 I'm not even sure if this device supports Modbus over RS232 - the documentation states two different things. Have you tried using RS485 instead? RE: RS232 Communacation - mkaymak - 25.05.2023 Yeah i've tried but still no clue. Should i change addresses to Hex ? RE: RS232 Communacation - mkaymak - 26.05.2023 After a few tries i got invalid CRC error.How can i solve it? RE: RS232 Communacation - admin - 26.05.2023 Are you using RS232 or RS485? Is GND connected between devices? RE: RS232 Communacation - mkaymak - 29.05.2023 I'm using RS232 and ground is connected Code: {
"manufacturer": "DATAKOM",
"description": "D300 JENERATOR",
"mapping": [
{ "address": 10240, "name": "Sebeke Faz L1 gerilimi", "datatype": "uint32", "bus_datatype": "uint32", "type": "inputregister"},
{ "address": 10242, "name": "Sebeke Faz L2 gerilimi", "datatype": "uint32", "bus_datatype": "uint32", "type": "inputregister"},
{ "address": 10244, "name": "Sebeke Faz L3 gerilimi", "datatype": "uint32", "bus_datatype": "uint32", "type": "inputregister"},
{ "address": 10264, "name": "Sebeke Faz L1 akimi", "datatype": "uint32", "bus_datatype": "uint32", "type": "inputregister"},
{ "address": 10266, "name": "Sebeke Faz L2 akimi", "datatype": "uint32", "bus_datatype": "uint32", "type": "inputregister"},
{ "address": 10266, "name": "Sebeke Faz L3 akimi", "datatype": "uint32", "bus_datatype": "uint32", "type": "inputregister"},
{ "address": 10292, "name": "Sebeke toplam aktif guc", "datatype": "uint32", "bus_datatype": "uint32", "type": "inputregister"},
{ "address": 10308, "name": "Sebeke toplam reaktif guc", "datatype": "uint32", "bus_datatype": "uint32", "type": "inputregister"},
{ "address": 10324, "name": "Sebeke toplam guc", "datatype": "uint32", "bus_datatype": "uint32", "type": "inputregister"},
{ "address": 10338, "name": "Sebeke Faz", "datatype": "uint16", "bus_datatype": "uint16", "type": "inputregister"},
{ "address": 10363, "name": "Yakit Seviyesi", "datatype": "uint16", "bus_datatype": "uint16", "type": "inputregister"}
]
}RE: RS232 Communacation - admin - 29.05.2023 Disable Modbus mapper, run this debug script and post what you get in Logs: https://forum.logicmachine.net/showthread.php?tid=1979&pid=16012#pid16012 Modify the script with correct serial port and Modbus device settings. RE: RS232 Communacation - rw_echo - 26.07.2023 Can anyone help me with the following questions? Thank you in advance. Q1:How many modbus slave devices can each RS485 or RS232 interface of LM drive? Q2:Is there a limit on the total length range of the bus? RE: RS232 Communacation - Daniel - 26.07.2023 Q1 RS485 = 31, RS232 = 1 Q2. Not so simple https://electrical-engineering-portal.com/correct-cabling-modbus-rs485 RE: RS232 Communacation - rw_echo - 26.07.2023 @Daniel ,thank you for your timely answer. |