question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reading different registers in the same device +help reading some datas

See original GitHub issue

Good day!

Great tools for Modbus! It’s working perfectly!

Is it possible to read different registers using the same function for reading in flex getter? I’m trying to read different registers with a different address on the same device here 50521, 50528 and 50770

I’ve tried msg.payload = {'fc': 3, 'unitid': 69, 'address': [50521,50528,50770] , 'quantity': 3 } but seems to read 50521 and 50522 and 50523.

For now, I’m doing like this : [{"id":"dfab6cca.74f9c","type":"tab","label":"Test read buffer"},{"id":"5b09b1a.b5e725","type":"function","z":"dfab6cca.74f9c","name":"extract buffer","func":"msg.payload = msg.payload.buffer.readUInt32BE(0);\nreturn msg","outputs":"1","noerr":0,"x":800,"y":180,"wires":[["68fa93ee.cb764c"]]},{"id":"68fa93ee.cb764c","type":"debug","z":"dfab6cca.74f9c","name":"","active":true,"console":"false","complete":"payload","x":990,"y":160,"wires":[]},{"id":"2f0694da.fdc7fc","type":"function","z":"dfab6cca.74f9c","name":"buff to string","func":"msg.payload = msg.payload.buffer.toString('utf8',0,8)\n +'_'+ msg.payload.buffer.toString('utf8',9);\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":340,"wires":[["1beb007.056dc"]]},{"id":"4aab90d1.62e9e","type":"modbus-read","z":"dfab6cca.74f9c","name":"Automatic Read FC3","showStatusActivities":true,"showErrors":true,"unitid":"69","dataType":"HoldingRegister","adr":"50042","quantity":"16","rate":"5","rateUnit":"s","server":"8f02b0be.180e6","x":130,"y":340,"wires":[[],["2f0694da.fdc7fc"]]},{"id":"1beb007.056dc","type":"debug","z":"dfab6cca.74f9c","name":"","active":false,"console":"false","complete":"false","x":610,"y":340,"wires":[]},{"id":"2ea584ae.afc47c","type":"comment","z":"dfab6cca.74f9c","name":"Lire le Buffer 2x16 (U32 BE)","info":"","x":160,"y":60,"wires":[]},{"id":"554db64f.5e6e98","type":"comment","z":"dfab6cca.74f9c","name":"Lire un biffer Buffer 8x16 et mettre en UTF8 - Ici marque + modèle","info":"","x":280,"y":300,"wires":[]},{"id":"59774ec.ee77fb","type":"modbus-flex-getter","z":"dfab6cca.74f9c","name":"","showStatusActivities":false,"showErrors":false,"server":"8f02b0be.180e6","x":580,"y":160,"wires":[[],["5b09b1a.b5e725"]]},{"id":"92decbe2.624bb8","type":"inject","z":"dfab6cca.74f9c","name":"Voltage","topic":"Voltage","payload":"50520","payloadType":"str","repeat":"5","crontab":"","once":false,"x":120,"y":120,"wires":[["ceb5d6e0.bbff78","68fa93ee.cb764c"]]},{"id":"ceb5d6e0.bbff78","type":"function","z":"dfab6cca.74f9c","name":"Ask to modbus","func":"msg.payload = {'fc': 3, 'unitid': 69, 'address': msg.payload , 'quantity': 2 , 'Topic' : msg.topic}\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":160,"wires":[["59774ec.ee77fb"]]},{"id":"98a72a48.563c88","type":"inject","z":"dfab6cca.74f9c","name":"Courrant","topic":"Courrant","payload":"50528","payloadType":"str","repeat":"5","crontab":"","once":false,"x":120,"y":160,"wires":[["ceb5d6e0.bbff78"]]},{"id":"ee7cdab.274e828","type":"inject","z":"dfab6cca.74f9c","name":"Wh","topic":"Wh","payload":"50770","payloadType":"str","repeat":"5","crontab":"","once":false,"x":110,"y":200,"wires":[["ceb5d6e0.bbff78"]]},{"id":"8f02b0be.180e6","type":"modbus-client","z":"","name":"Modbus Serial USB","clienttype":"serial","bufferCommands":true,"stateLogEnabled":true,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/Modbus-USB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"2","serialParity":"none","serialConnectionDelay":"100","unit_id":"","commandDelay":"50","clientTimeout":"1000","reconnectTimeout":"2000"}]

But i’ve several same counters to read so the best would be to inject the unitId and have a function that read all the registers i need for the differents units.

Also, would it be possible to pass the msg.topic to the buffered output?

best

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
biancodecommented, May 16, 2017

a Wiki article would be cool about ttyAMA0 if you got some experiences

0reactions
biancodecommented, May 16, 2017

OK try v1.1.0 it is released now

Read more comments on GitHub >

github_iconTop Results From Across the Web

If the PC register is simultaneously read and written, does its ...
If the PC register is simultaneously read and written, does its read data contain the previous data or the newly-written data (assembly, CPU...
Read more >
If the PC register is simultaneously read and written, does its ...
A program counter is normally special enough that it's not part of a register file with other registers. You don't have a "read...
Read more >
how to read multi registers using I2C from my receiver
hi all if i need to read several registers from my accelerometer , should i send all registers addresses once and then start...
Read more >
Brief Explaination on the Different Types of Register - eduCBA
The memory address register is mainly used for reading and writing operation of data from memory. At the time of reading operation, the...
Read more >
Registers and RAM: Crash Course Computer Science #6
Take the 2017 PBS Digital Studios Survey: http://surveymonkey.com/r/pbsds2017. Today we're going to create memory! Using the basic logic ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found