String conversion RS-Logic

Join Date
Oct 2008
Location
Copenhagen
Posts
24
Hi

In the attempt to create my first RS-Logic program, I have met a small challenge, on how to cast/convert data.

I receive an array of 255 SINT from profibus. In this 255, I know that SINT[4] to SINT[24], is a 20 charater ASCII string.

My problem is, that I can’t find a instruction, that I can use to extract this as a string.

I have tried something like this without any luck.

Code:
BATCH_ID := "";
FOR Iterator := 4 to 24 DO

	CONCAT(BATCH_ID, MVI56PDPMV1.PROFIBUSData.Input[ Iterator ], BATCH_ID);

END_FOR;

Does anyone have a suggestion on how I can do this conversion ?
 
Use a COP or CPS instruction to move the 20 bytes into the .DATA[x] portion of a String tag.

COP
Source: MVI56PDPMV1.PROFIBUSData.Input[4]
Dest: MyString.Data[0]
Length: 20

Use a MOV instruction to move a constant of 20 into the .LEN argument of that String tag.

MOV
Source: 20
Destination: MyString.Len
 

Similar Topics

Hi All, I am having trouble converting a real to string and keep it to 2 decimal places. I'm sure its a simple solution. Any help is appreciated
Replies
2
Views
263
I am working on calculating a checksum value for a command that is to be sent from an Allen-Bradley CompactLogix PLC to a Mass flow controller...
Replies
2
Views
4,300
I have a Cognex 8050 barcode scanner and I am trying to pull recipes from this information. The recipes are in different locations in the string...
Replies
19
Views
3,693
hi, I am trying to convert a string value to int but it is not working and I cannot figure out why. I have a string which is constantly...
Replies
10
Views
10,147
Hello All Im using a FESTO PLC with Codesys. I have a string, named "Program1", which Im trying to convert to a datatype of Word. Im not...
Replies
4
Views
12,474
Back
Top Bottom