[ 
https://issues.apache.org/jira/browse/PLC4X-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17393904#comment-17393904
 ] 

Maida Baralić commented on PLC4X-309:
-------------------------------------

I'm not sure if this might be caused by how this is handled in DataItemIO. 

Because when I have an array of bytes like 0x01, 0x02, 0x03, there's a loop 
iterating over them. However value of the individual values is written as a bit 
value -> 

value = val.getBoolean();
writeBuffer.writeBit("", value, new WithWriterArgs[0]);

And if I try to write a single byte value, it succeeds only if I specify an 
array of boolean values. 

plcWriteRequest.addItem("array", "%DB4:100.0:BYTE", true, false, false, false, 
false, false, false, false); //SUCCESS
plcWriteRequest.addItem("array1", "%DB4:100.0:BYTE", 0x02); //FAILURE -> class 
org.apache.plc4x.java.spi.values.PlcBYTE cannot be cast to class 
org.apache.plc4x.java.spi.values.PlcList

Not sure if this additional info helps you in any way

 

> [S7] Writing byte array not working
> -----------------------------------
>
>                 Key: PLC4X-309
>                 URL: https://issues.apache.org/jira/browse/PLC4X-309
>             Project: Apache PLC4X
>          Issue Type: Bug
>          Components: Driver-S7
>    Affects Versions: 0.8.0
>         Environment: Windows 10
>            Reporter: Maida Baralić
>            Priority: Major
>         Attachments: DB4.pdf, PLCWrite.zip, write_byte_array_0.8.0.pcapng, 
> write_byte_array_0.9.0.pcapng
>
>
> I'm having some issues with writing a byte array using S7 driver to the 
> S7-1200.
> I'm a bit new to the communication with PLCs, so I'm not sure if I'm doing 
> something wrong.
> I've followed the example of how to write a byte array to the connection, 
> however I'm getting an INTERNAL_ERROR as a response code from the library and 
> in the Wireshark the status from the PLC is inconsistent data type. 
> I've attached both the sample project that's not working for me, my 
> definition of byte array on the PLC and also  Wireshark capture. 
> It's possible that I'm not doing something right, however I can't figure it 
> out. 
> Writing of most of the single values is working, however the array is the 
> problem. And as far as I understood from the code and documentation arrays 
> should be supported. 
> Any help would be appreciated.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to