I have an application that needs to get some string parameters for an SQL query that are coming back from a PLC and then send the results back to the PLC in under 450ms. So far I have it working with the S7+ driver at around 350ms, but I'm trying to gain a little overhead. In doing this I've switched over to the original s7 driver using TSPP. This all works, but the one problem I have no is in string handling in OA. It seems like the string transformation doesn't properly understand s7 strings?
It knows that the first two bytes are header data, but it doesn't correctly parse them. Right now I have the driver set to datablock byte and the address is DB5.DBB18:12. I set the transformation to string, and the string comes in fine; however, the lack of handling the current length from the header leaves old data in my tag.
IE:
Old string: ‘Hello’
Modify string in PLC to: ‘Matt’
OA reads: ‘Matto’ since the ‘o’ was still in the PLC’s memory
It should be getting the current length from the header and omitting the 'o', but it doesn't do this in practice.
Have I configured something wrong, or is this an error inside the transform? Could I use blob and maybe handle this inside of my CTRL function that sends the parameters to the stored procedure inside SQL?
How to read S7 string properly?
- Gertjan van Schijndel
- Posts:634
- Joined: Mon Aug 02, 2010 10:37 am
Re: How to read S7 string properly?
Try it with the [s7] config entry 'useStringLengthInfo = "Y"'.
- MattPaulissen
- Posts:26
- Joined: Fri Feb 19, 2016 9:27 pm
Re: How to read S7 string properly?
Thanks! I'll try this!