Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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 => '192.168.0.57', 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;


Comment on Re^3: Need help with Modbus
Select or Download Code
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 -> 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?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-12-26 19:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (174 votes), past polls