Ok, i have now got quite a bit of communication working.. I placed a shift register in the while loop around both the serial read and write block. (if i placed them in seperate while loops, none of them worked).
Replace array subset works fine, and replaces the value in the array according to the value of "bytes at port". There is still some "flickering" in the values, but with some filtering i think i will be able to use these values further on in the project!
Another thing though.. I thing the com is extremely slow.. Now i transfer 12 ascii chars (12x8bits= 96 bits) about three times a second, wich equals 96x3=288 bits/s ?? I can`t imagine that the siemens PLC CP340 module is the bottleneck. I can of course incease the number of chars, but still an update rate of 3Hz is quite slow.