Technical Forum

STEP 7 / STEP 7 Lite

move data type array of string

Thread Starter: Itzabhi   Started: 5/29/2012 4:03 AM   Replies: 5

« Previous thread Next thread »
Page 1 of 1 (6 items)
  5/29/2012, 4:03 AM
Joined 1/27/2011
Last visit: 4/30/2013
Posts: 11
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
I am working on a project in which I have to move some data from a datablock into a local varriable of type array of string. But I dont know how to do so. Please help......

Thanks in advance...
Top
  5/29/2012, 7:22 AM
Joined 10/31/2005
Last visit: 5/24/2013
Posts: 2092
Rating:
Rated: Excellent [4.08 out of 5 / rated 200 time(s)]. (200) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Generally - use SFC20. Please give us more details to get more defined answer. Also programming language in which you're trying to make it also important.
Top
  5/29/2012, 7:41 AM
Joined 1/27/2011
Last visit: 4/30/2013
Posts: 11
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
I have already tried the SFC20. but it didn't work.sad
The programming language is ladder. I think SFC20 does not support data type array of string at its output. Is there any other functions..
I have a datablock containing data of type string...I want to move this into the local static varriable of an FB which is of type array of string...
I am attaching a couple of snaps for your referance....

Attachment: Untitled1.jpg  (55 Downloads)



=== Edited by Itzabhi @ 5/29/2012 7:59 AM [GMT ] ===



Top
  5/29/2012, 10:01 AM
Joined 10/31/2005
Last visit: 5/24/2013
Posts: 2092
Rating:
Rated: Excellent [4.08 out of 5 / rated 200 time(s)]. (200) 
Users with special expertise supervising conferences
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

SFC 20 shouldn't work like this - you have 32 bytes on one side and 640 bytes as destination. Actually it may work (as destination area is larger then source area) and copy to 1st array element, but it's clearly wrong program design. Do you need to copy your source string to some array element with  predefined index?

In this case you may try to use P#DIX168.0 Byte 32 (to copy source string to Text[2] for example). I don't like this variant for some reasons, but it can be applicable.

If index of destination string is defined in run-time you would be forced to make ANY pointer in PLC program, with LAD it would be really ugly. In STL you can use L P## construction and code would look better. But easiest way is SCL, where you would just have

Text[i] := "SMS_Text".Stn_1_msg

Maybe i miss something in your task?




=== Edited by Aret @ 5/29/2012 10:04 AM [GMT ] ===


Top
  5/29/2012, 10:44 AM
Joined 1/27/2011
Last visit: 4/30/2013
Posts: 11
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Thanks Aret,

you have catched my requirement perfectly...
but I have not any idea about SCL....would you please explain it in ladder or STL in details??
Top
  5/29/2012, 11:18 AM
Joined 10/31/2005
Last visit: 5/24/2013
Posts: 2092
Rating:
Rated: Excellent [4.08 out of 5 / rated 200 time(s)]. (200) 
Users with special expertise supervising conferences
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

So you need predefined index or variable is used as index?grin

For second variant - for example you can refer to 

https://www.automation.siemens.com/WW/forum/guests/PostShow.aspx?HTTPS=REDIR&PostID=128429&language=en.

As for the LAD - you would have to place some STL commands inside networks, though the rest of code can stay as LAD blocks. 

Top
Page 1 of 1 (6 items)
Actions