0

I have a Citrino PLC at my company, and I would like to get the PLC's internal information. We currently use InduSoft Web Studio which obtains this information via Modbus TCP.

https://prnt.sc/J7vq2zHhNUdp

Using the InduSoft Web Studio i can get and show infomation by Modbus TCP

https://prnt.sc/i894cShne45v

I try use ModbusMaster lib:

require_once dirname(__FILE__) . '/../Phpmodbus/ModbusMaster.php';

// Create Modbus object
$modbus = new ModbusMaster("192.168.0.229", "TCP");

try {
    // FC 3
    $recData = $modbus->readMultipleRegisters(0, 12288, 6);
}
catch (Exception $e) {
    // Print error information if any
    echo $modbus;
    echo $e;
    exit;
}

// Print status information
echo "</br>Status:</br>" . $modbus;

// Print read data
echo "</br>Data:</br>";
print_r($recData); 
echo "</br>";

But it just doesn't return any information:

https://prnt.sc/xCAG_Xr_gJS3

  • Hi @Rafael, since there is no specific error message, it seems that it is connecting... Is the initial address `12288` correct? I don't know Indusoft, but there the address is starting at `55005`. – dwpessoa Oct 17 '22 at 12:44
  • Hi @dwpessoa thanks for answering, I also tested it but I can't get the information – Rafael Bernardo Oct 20 '22 at 16:14
  • What does "I can't get the information" mean? (are you still getting 0's or something else?). You may find it easier to experiment using a tool (e.g. [QModMaster](/sourceforge.net/projects/qmodmaster/)/[modpoll](https://www.modbusdriver.com/modpoll.html)/[mbpoll](https://github.com/epsilonrt/mbpoll)) rather than code - it looks like the data will be floating point (so some decoding will be needed). Where possible please copy/paste/format text [rather than using screenshots](https://meta.stackoverflow.com/a/285557/11810946). – Brits Oct 20 '22 at 21:54

1 Answers1

0

As far as I know, the conventional method is to read and write PLC data through OPCUA or HTTP POST after connecting to PLC through communication middleware, such as Kepserver or open source LECPServer

https://www.kepware.com/en-us/

https://www.lecpserver.com

Use lecpserver to communicate with PLC

Our MES uses this method. The only bad thing is that these two middleware are based on windows

JamesChan
  • 51
  • 3