Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Need help with Modbus

by raulpena (Initiate)
on Apr 26, 2013 at 18:24 UTC ( #1030877=note: print w/ replies, xml ) Need Help??


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

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.


Comment on Re^4: Need help with Modbus
Re^5: Need help with Modbus
by Khen1950fx (Canon) on Apr 27, 2013 at 03:31 UTC
    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.
Re^5: Need help with Modbus
by olibo (Initiate) on Aug 17, 2013 at 14:46 UTC
    Thats not a Modbus-Response. It`s only a output of your request. For more information check this example -> http://cpansearch.perl.org/src/COSIMO/Protocol-Modbus-0.09/examples/read_coils_full_api.pl 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?
        With Modbus 0.9 -> see http://search.cpan.org/~cosimo/Protocol-Modbus/lib/Protocol/Modbus/Transaction.pm ---
        use Protocol::Modbus; # Initialize protocol object my $proto = Protocol::Modbus->new( driver=>'TCP' ); # Get a request object my $req = $proto->request( function => Protocol::Modbus::FUNC_READ_COILS, # or 0x01 address => 4016, # Register dispavgVpv from MidNight Charger quantity => 1, ); # Init transaction and execute it, obtaining a response my $trn = Protocol::Modbus::Transaction->new( request=>$req ); my $res = $trn->execute(); # Pretty-print response on stdout print $res . "\n"; # Modbus Response PDU(......)
        ##############################################
        or you can use MBClient -> https://github.com/sourceperl/MBclient
        use strict; use MBclient; my $m = MBclient->new(); # define server target $m->host("localhost"); $m->unit_id(1); # read 16 bits register from ad 0 to 9 my $words = $m->read_holding_registers(4100, 40); # First 40 Register +of MidNight Charger # print words foreach my $word (@$words) { print $word."\n"; } # clean exit $m->close(); exit 0;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030877]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2014-11-29 10:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (204 votes), past polls