meichf opened a new issue, #1646:
URL: https://github.com/apache/plc4x/issues/1646
### What happened?
I wrote two programs according to the documentation on the official website
of PLC4X to read Allen Bradley PLC, model Logix5571, but all the values read
were null.
Here is the code. The result is that all four tag values in asPlcValue are
null.
code for EtherNet/IP protocol:
String connectionString =
"eip://192.168.0.2:44818?slot=0&bigEndian=false";
try (PlcConnection plcConnection =
PlcDriverManager.getDefault().getConnectionManager().getConnection(connectionString))
{
final PlcReadRequest.Builder readrequest =
plcConnection.readRequestBuilder();
//(3.1)
readrequest.addTagAddress("tag1", "%A:DINT");
readrequest.addTagAddress("tag2", "%B:INT");
readrequest.addTagAddress("tag3", "%C:SINT");
readrequest.addTagAddress("tag4", "%D:REAL");
//(3.2)
final PlcReadRequest rr = readrequest.build();
//(3.3)
final PlcReadResponse szlresponse = rr.execute().get();
PlcValue asPlcValue = szlresponse.getAsPlcValue();
} catch (PlcConnectionException e) {
throw new RuntimeException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}
code for Logix protocol:
String connectionString =
"logix://192.168.0.2:44818?slot=0&bigEndian=false";
try (PlcConnection plcConnection =
PlcDriverManager.getDefault().getConnectionManager().getConnection(connectionString))
{
PlcConnectionMetadata metadata = plcConnection.getMetadata();
final PlcReadRequest.Builder readrequest =
plcConnection.readRequestBuilder();
//(3.1)
readrequest.addTagAddress("tag1", "A:DINT");
readrequest.addTagAddress("tag2", "B:INT");
readrequest.addTagAddress("tag3", "C:SINT");
readrequest.addTagAddress("tag4", "D:REAL");
//(3.2)
final PlcReadRequest rr = readrequest.build();
//(3.3)
final PlcReadResponse szlresponse = rr.execute().get();
//(3.4)
PlcValue asPlcValue = szlresponse.getAsPlcValue();
log.info("Tags: " + asPlcValue);
} catch (PlcConnectionException e) {
throw new RuntimeException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}`
here is the tags:

### Version
v0.12.0
### Programming Languages
- [X] plc4j
- [ ] plc4go
- [ ] plc4c
- [ ] plc4net
### Protocols
- [ ] AB-Ethernet
- [ ] ADS /AMS
- [ ] BACnet/IP
- [ ] CANopen
- [ ] DeltaV
- [ ] DF1
- [X] EtherNet/IP
- [ ] Firmata
- [ ] KNXnet/IP
- [ ] Modbus
- [ ] OPC-UA
- [ ] S7
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]