Sign in to follow this  
Followers 0
panic mode

assigning string value in S7-300

4 posts in this topic

Is there a way to hardcode string value without resorting to hex etc., something like: L 'Beer Opener' T "Tool".Name

Share this post


Link to post
Share on other sites
Have you tried entering your string data in a DB block and then accessing it that way? Below is a link to a tech note from siemens that might assist you. http://support.automation.siemens.com/WW/view/en/16848975

Share this post


Link to post
Share on other sites
Yes, simply enter it in the DB editor as Rod suggests. That is OK if the names shall never change. Or use SCL. Especially if the strings can change or you have to manipulate them programmatically, then it is one of the cases where SCL makes your life soooo much easier: FUNCTION FC1 : INT VAR_TEMP END_VAR TOOL1.Descr_name := 'Beer opener'; TOOL1.weight := 0.05 ; // kg TOOL1.length := 145.0 ; // mm ; TOOL2.Descr_name := 'Grill palette'; TOOL2.weight := 0.12 ; // kg TOOL2.length := 320.0 ; // mm FC1 := 100; END_FUNCTION

Share this post


Link to post
Share on other sites
Thank you both. It is done and it works but I'm going to ask boss to allow uprgading S7 (currently using Standard which doesn't have SCL)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0