astecker commented on issue #930:
URL: https://github.com/apache/plc4x/issues/930#issuecomment-1731198982

   As a workaround you could try to write the String as multiple USINT (as i 
had problems writing them as an array):
   
   val db = 1000
   val lengthOfStringInS7 = 30
   val string: String = "abc"
   val toWrite = 
(""+Char(lengthOfStringInS7)+Char(string.length)+string).take(lengthOfStringInS7+2).toCharArray().mapIndexed{
 idx, chr ->
               Triple("fancy_field_name_$idx", "${db+idx}:USINT" , chr.code)
   }
   
   
     val writeResponse = with(plcConnection.writeRequestBuilder()) {
         toWrite.forEach { (name, fieldQuery, value) ->
             addItem(name, fieldQuery, value)
         }
         build()
     }.execute()[5000, TimeUnit.MILLISECONDS]
   
   
   Code is Kotlin, and it's a stripped excerpt of a larger project, so expect 
some errors while substituting variable names. And better lookup the meaning of 
the first two bytes. For me it works, but it looks like its not checked by the 
S7 when written..?


-- 
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: dev-unsubscr...@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to