Logic Machine Forum
Modbus Mapping - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Modbus Mapping (/showthread.php?tid=2745)



Modbus Mapping - AlexLV - 24.07.2020

Hi,

need help a little - I can't correctly read statuses from ventilation machine.  I create mapping, but some is done not correctly:

In manual:

Current mode R/W unsigned char 0 - 10
READ ONLY:
Stanby = 0,
Away = 1,
Normal = 2,
Intensive = 3,
Boost = 4,
Kitchen = 5,
Fireplace = 6,
Override = 7,
Holiday = 8,
Air quality = 9,
Off = 10
WRITE ONLY:
Away = 1,
Normal = 2,
Intensive = 3,
Boost = 4


Mine:

{
      "name": "Current Mode Statuss and Change",
      "bus_datatype": "uint8",
      "datatype": "uint16",
      "type": "register",
      "address": 4,
  "writable": 1,
      "value_custom": {
        "0": "StandBy",
        "1": "Away",
        "2": "Normal",
"3": "Intensive",
"4": "Boost",
"5": "Kitchen",
"6": "Fireplace",
"7": "Override",
"8": "Holiday",
"9": "Air Quality",
"10": "Off"
      }


Also problem to read CO2 sensor:

manual:

Air quality or humidity
(sensor 1 - B8) RO unsigned short 0 - 65535 ppm,%

Mine:

{
"name": "AirQuality sensor2 CO2",
"bus_datatype": "uint8",
"datatype": "uint8",
"type": "register",
"address": 951,
"writable": 0,
"units": "ppm",
"value_multiplier": "1"
}

What datatype and bus datatype should be??

BR,

Alexander


RE: Modbus Mapping - Daniel. - 24.07.2020

Hi Use RTU read test with int16/uint16 and paste results for both registers.


RE: Modbus Mapping - AlexLV - 24.07.2020

Daniel,

sorry, I not mention I use Modbus TCP mapping, and as I found test works only for RTU mode..

Alex


RE: Modbus Mapping - Daniel. - 24.07.2020

Try via script then
Code:
require('luamodbus')
mb = luamodbus.tcp()
mb:open('192.168.0.1', 502)
mb:connect()

mb:setslave(1)

-- read from address 1000
value = mb:readregisters(1000)
log(value)



RE: Modbus Mapping - AlexLV - 24.07.2020

(24.07.2020, 13:28)Daniel. Wrote: Try via script then
Code:
require('luamodbus')
mb = luamodbus.tcp()
mb:open('192.168.0.1', 502)
mb:connect()

mb:setslave(1)

-- read from address 1000
value = mb:readregisters(1000)
log(value)

Daniel,

thank you very much, variant int16/uint16 working as needed.

Alex