Modbus TCP registers from one server

Hi,

I am trying to read some Modbus registers with Node-RED, but I have a problem with the registers.
The voltage registers are from adress 0 to 46 and the current registers from 128 to 236.

When I set the 'Quantity' on 236, I receive an error because there are a lot of registers not used (from 47 to 127). Two 'modbustcp' nodes in parallel didn't work because I they want to connect to the same server.

Is there anyone who knows how to solve this problem?


image

Due to protocol design, there is a limit on the number of registers (I cant find the info right now but its about 100)

So, make 3 requests in series

  1. Registers 0 (47 long)
  2. Registers 128 (100 long)
  3. Registers 228 (8 long)

PS, buffer-parser can make simple work of converting the int16 values into sensible results (bools/floats/32 bit numbers, all in a nicely named object)

Hi,

I can't install that nodes of Modbus, every time I try to install that nodes I get an error

@Steve-Mcl can you show your program inside the 'set msg.result.data1'?

What is the error. Have you reported this anywhere?

It was a non working demo (for visual purposes) whereby i try to show that you should copy the output of each modbus read into a single objects properties so that later in the flow, all parts of the modbus data would be available in one place for the buffer parser node can convert all the int16 data into nicely formatted int32/float/bool or whatever.

@Steve-Mcl
this is the error :
2022-02-14T13:19:48.913Z Install : node-red-contrib-modbus 5.21.0

2022-02-14T13:19:48.922Z npm.cmd install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-modbus@5.21.0
2022-02-14T13:19:54.980Z [err] npm
2022-02-14T13:19:54.980Z [err] WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
2022-02-14T13:19:57.071Z [err] npm
2022-02-14T13:19:57.071Z [err] ERR! code 1
2022-02-14T13:19:57.071Z [err] npm ERR! path
2022-02-14T13:19:57.071Z [err] C:\Users\User.node-red\node_modules@serialport\bindings
2022-02-14T13:19:57.073Z [err] npm
2022-02-14T13:19:57.073Z [err] ERR! command failed
2022-02-14T13:19:57.073Z [err] npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2022-02-14T13:19:57.073Z [err] npm ERR!
2022-02-14T13:19:57.073Z [err] prebuild-install WARN install No prebuilt binaries found (target=17.5.0 runtime=node arch=x64 libc= platform=win32)
2022-02-14T13:19:57.073Z [err] npm ERR! gyp info it worked if it ends with ok
2022-02-14T13:19:57.073Z [err] npm ERR!
2022-02-14T13:19:57.073Z [err] gyp info using node-gyp@3.4.0
2022-02-14T13:19:57.073Z [err] npm ERR! gyp info using node@17.5.0 | win32 | x64
2022-02-14T13:19:57.073Z [err] npm
2022-02-14T13:19:57.073Z [err] ERR! gyp ERR! configure error
2022-02-14T13:19:57.073Z [err] npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
2022-02-14T13:19:57.073Z [err] npm
2022-02-14T13:19:57.073Z [err] ERR! gyp ERR! stack at failNoPython (C:\Users\User.node-red\node_modules\node-gyp\lib\configure.js:449:14)
2022-02-14T13:19:57.073Z [err] npm ERR! gyp ERR! stack at C:\Users\User.node-red\node_modules\node-gyp\lib\configure.js:404:11
2022-02-14T13:19:57.073Z [err] npm ERR! gyp ERR! stack at callback (C:\Users\User.node-red\node_modules\graceful-fs\polyfills.js:295:20)
2022-02-14T13:19:57.073Z [err] npm ERR!
2022-02-14T13:19:57.073Z [err] gyp ERR! stack at FSReqCallback.oncomplete (node:fs:198:21)
2022-02-14T13:19:57.073Z [err] npm
2022-02-14T13:19:57.073Z [err] ERR! gyp ERR! System Windows_NT 10.0.19043
2022-02-14T13:19:57.073Z [err] npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\User\.node-red\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
2022-02-14T13:19:57.073Z [err] npm ERR!
2022-02-14T13:19:57.073Z [err] gyp ERR! cwd C:\Users\User.node-red\node_modules@serialport\bindings
2022-02-14T13:19:57.073Z [err] npm ERR! gyp ERR! node -v v17.5.0
2022-02-14T13:19:57.073Z [err] npm ERR! gyp ERR! node-gyp -v v3.4.0
2022-02-14T13:19:57.073Z [err] npm ERR!
2022-02-14T13:19:57.073Z [err] gyp ERR! not ok
2022-02-14T13:19:57.074Z [err]
2022-02-14T13:19:57.074Z [err] npm
2022-02-14T13:19:57.074Z [err] ERR! A complete log of this run can be found in:
2022-02-14T13:19:57.074Z [err] npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2022-02-14T13_19_49_631Z-debug-0.log
2022-02-14T13:19:57.093Z rc=1

You probably didnt install the "build tools" when you installed node-js - these are required for some nodes (like the serial port nodes which are part of modbus nodes)

I would recommend you uninstall node-js V17, re-install V16 LTS and be certain to install the "build tools"

image

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.