favalex / modbus-cli

Command line tool to access Modbus devices
Mozilla Public License 2.0
158 stars 30 forks source link

modbus rtu slave on linux #24

Open kush930 opened 6 months ago

kush930 commented 6 months ago

Hi all ,

I have successfully installed master branch of modbus-cli on my ubuntu-20.04.3 os, from given link- https://github.com/favalex/modbus-cli

I want to use modbus rtu slave stack, i am taking my ubuntu machine as a master.

kush@kush-Latitude-3520:~/Music/14-dec$ modbus

usage: modbus [-h] [-r REGISTERS] [-s SLAVE_ID] [-b BAUD] [-p STOP_BITS] [-P {e,o,n}] [-v] [-S] [-t TIMEOUT] [-B {le,be,mixed}] device access [access ...]
modbus: error: the following arguments are required: device, access

I have energy meter, which having slave address 1 and register address 3027 and baudrate 9600 and device access /dev/ttyUSB0 and i want to read 16-bit data , i am new in this, first time i am trying.

when i am running the command,I am facing this issue-

kush@kush-Latitude-3520:~/Music/14-dec$ modbus -r 3027 -s 1 -b 9600 -p 1 -P n -v /dev/ttyUSB0

usage: modbus [-h] [-r REGISTERS] [-s SLAVE_ID] [-b BAUD] [-p STOP_BITS]
              [-P {e,o,n}] [-v] [-S] [-t TIMEOUT] [-B {le,be,mixed}]
              device access [access ...]

modbus: error: the following arguments are required: access

if anyone knows where i am doing mistake, please guide me.

T&R Kush Kumar

favalex commented 6 months ago

Try modbus -s 1 -b 9600 -p 1 -P n -v /dev/ttyUSB0 3027

-r is for loading a file that gives registers a name, it's optional and explained in the documentation.

kush930 commented 6 months ago

Try modbus -s 1 -b 9600 -p 1 -P n -v /dev/ttyUSB0 3027

-r is for loading a file that gives registers a name, it's optional and explained in the documentation.

Thank you favalex.its working now.

kush930 commented 6 months ago

Hi all,

I want to use my PC (Linux OS) as a slave, what should i do that my PC behave as a slave, if anyone having any idea please share with me or guide me how to do.

T&R Kush kumar