How to set an S7 string

Werner

Member
Join Date
Apr 2005
Location
IJsselstein
Posts
336
Hi!

I have an DB with strings of a type String[10]
How can I set the strings from my software.

I'm looking for something like:

Code:
L 'Test'
T Temp.string[10]

After this set I can use the blockmove SFC20 instruction to copy the string to the DB.

When I type:

Code:
L	  'TEST' // This works
L	  'TEST1' // Syntax error

Can anyone give me some answers or tips?!

Thanks.
 
I found out that Siemens suggest to make a DB with all the text messages you need. Then you can copy the text you want from te DB. OK this works but if anyone knows how to do it in an other way please feel free to tell me.

Thanks!
 
well... i think, you can access directly elements like an array if string defined in datablock :

L "swp".swpstr[1]
T "swp".swpstr[1]

...but... can i ask you what is the string good for? - i never need an string in CPU (just in OP) ... and i have suspicion about dynamic changing of string length too ...
 
Declare your strings in a DB and then select the string from the DB as the source.

Using the L 'TEST' method will only work for up to 4 characters as this occupies the full 32 bits of the accumulator.
 
marius said:
well... i think, you can access directly elements like an array if string defined in datablock :

L "swp".swpstr[1]
T "swp".swpstr[1]

...but... can i ask you what is the string good for? - i never need an string in CPU (just in OP) ... and i have suspicion about dynamic changing of string length too ...

My customer needs a recipe list. But he wanted some special editing and limits to the recipe which was hard to do in protool. Thats why I have a fixed length recipe list in the plc. String lengths are also fixed so no worry's there.
 

Similar Topics

Action On Release command Set(ConveyorPopup,ConveyorPop_1) rejected w/ string tags. SetStringTag(index, data) wants an index. How does one pass...
Replies
8
Views
958
I have experience programming with languages like C++ but I am completely new to the world of PLCs. I have an existing application in Cscape and...
Replies
5
Views
1,598
hihi i have a panel view c600 and micrologix 1100 im trying to make Tag in the panel view to change the preset time on t4:0 in the plc how...
Replies
3
Views
2,829
Hi Gents, I am struggling with the following piece of code. I have variable Strings i want to move to a general Data area as i go through...
Replies
10
Views
3,845
Hi need help why this “failure 5 emergency stop “ appears at every startup in the morning ? Have to shut off main switch at least 10 times on...
Replies
19
Views
296
Back
Top Bottom