Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^3: Need help with Modbus

by Khen1950fx (Canon)
on Jan 27, 2012 at 06:50 UTC ( #950269=note: print w/replies, xml ) Need Help??

in reply to Re^2: Need help with Modbus
in thread Need help with Modbus

The $req variable gets the modbus reply.

#!/usr/bin/perl -l use strict; use warnings; use Protocol::Modbus; $|=1; my $modbus = Protocol::Modbus->new( driver => 'TCP', transport => 'TCP', ); my $trs = Protocol::Modbus::Transport->new( driver => 'TCP', address => '', port => 502, timeout => 3, ); my $req = $modbus->request( function => 4, address => 1, quantity => 75, value => 0x0000, ); print "=" x 60; print "Response: ", $req; print "=" x 60; $trs->disconnect;

Replies are listed 'Best First'.
Re^4: Need help with Modbus
by raulpena (Initiate) on Apr 26, 2013 at 18:24 UTC
    Hello. Did this work for you? I am trying to communicate with a charge controller that supports modbus/tcp but when I modify code above I don't even see traffic leave my host. I get a response from the program that looks like "Response: ModbusRequest PDU(000000000006ff040001000a)" but I don't know what that means. I am going crazy over this. Please help. Thank you.
      The module's author has not yet completely finished the module. It doesn't interface with PLC devices. It only generates modbus protocol messages at this time. For more info, see Modbus Specifications and Guides.
      Thats not a Modbus-Response. It`s only a output of your request. For more information check this example -> Which charger you want to use?
        I haven't looked at ModBus since that post. Could you post a snippet to demonstrate the charger that you use?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950269]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2018-01-21 10:50 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (227 votes). Check out past polls.