String data type within PROD_CONS

OP's update said it's 6 numeric characters. That should be very straightforward to convert the string to DINT (STOD instruction) and send a DINT[10] to the other PLC, which can use DTOS to convert it back to a string.



If there'll ever be other characters or long strings, though, it's probably best to just send 2 STRING[5] tags.
 
I thinks it's the best approach suggested so far, i.e. using STOD=>DINT[10]=>prod=>cons=>DTOS, but there may be an issue if the 5-digit number has leasing zeroes, which I suspect the DTOS instruction would not replace in the result, so that would require a bit more code (e.g. add 10,000,000 to the DINTs on the producer side, and truncate the leading 1 from the strings on the consumer side).

If each string is always fixed at six characters, then another approach would be to concatenate the ten strings into a single 60-character string, which is "produced," and finally reconstructing the ten individual strings on the "consumer" side.

Pro: the content of the string does not matter (decimal digits or not)

Con: any future expansion is limited to thirteen 6-character string per prod/cons string.

Anyway, there are multiple ways to skin this cat; it's only moving bits around.
 
Last edited:
Sorry I have been MIA on this subject that I started. To clarify, we are passing data from a control logix plc to another control logix plc. We transfer an item number that is normally 6 characters (numbers). The common string data type we create is a STRING[10]. I was told by an integrator that you could not pass string data through PROD_CONS. By looking through the posts it looks like this is fairly straight forward. I would just need to create the UDT on both sides as STRING[10]'s. The reason for not messaging is we are transferring data from one company to another company where company A says that prod_cons are more secure. I am not 100% sold on that but here we are. Thanks!

However you end up packaging your data, produce/consume is not more secure.
 
Sorry I have been MIA on this subject that I started. To clarify, we are passing data from a control logix plc to another control logix plc. We transfer an item number that is normally 6 characters (numbers). The common string data type we create is a STRING[10]. I was told by an integrator that you could not pass string data through PROD_CONS. By looking through the posts it looks like this is fairly straight forward. I would just need to create the UDT on both sides as STRING[10]'s. The reason for not messaging is we are transferring data from one company to another company where company A says that prod_cons are more secure. I am not 100% sold on that but here we are. Thanks!

Inquiring mind… why on earth are they storing 6 characters of data in types that large? What’s wrong with creating a STR_8 per item number?
 

Similar Topics

Hello guys, i want to use string data type in plc m221 by Schneider electric. to transmit data from software scada expert vijeo citect to plc...
Replies
0
Views
2,439
Good Morning , I'm trying to move a total for a dose into a dose history. I'm able to get my totals to move just fine. I would also like to...
Replies
6
Views
2,407
I am using a IO_LINK CALL FB for reading data from sensor and when I record the Vendor ID or Name in String datatype I get the first two...
Replies
5
Views
2,284
Hello all, I need help creating a string. The PLC is an A/B L-55 logix controller. The controller receives data from a Sick bar code reader in...
Replies
2
Views
4,249
Hi is it possible to use strings as in/out parameters for an FC block in S7. i am trying to make an FC that searches for a specific code in a...
Replies
2
Views
3,666
Back
Top Bottom