CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Mon Jan 20, 2020 1:28 pm

All times are UTC+01:00

Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Jun 08, 2007 12:30 am 

Joined: Tue Jun 05, 2007 11:10 pm
Posts: 2

I'm new to IEC 61131-3 programming. Could someone clarify what the assignment operator (":=") in ST does when working with strings.
E.g. myString := originalString;

I was assuming this does a full character by character copy of the string, but I know in some lanuages only a reference pointer is copied. Now I wonder if my assumption is incorrect since there is string copy function in the system string library - SysStrCpy() in SysLibStr.lib.

I've had some strange bugs happening ever since I started using strings and SFC (SFCCurrentStep in particular) and want to make sure I am using strings correctly.

Any feeback on STRING usage is appreciated.

Sebastian Hutten

 Post subject:
PostPosted: Sat Jun 09, 2007 10:22 am 
Site Admin

Joined: Wed Jul 20, 2005 2:32 pm
Posts: 153

You are right. ':=' is a full character by character copy. (Certainly you may get a pointer to string see. ADR operator). Moreover you can use '=','>','<' in ST (but not '+', use CONCAT function). For example:

IF s2 = 'Shutten' THEN
s1 := CONCAT('Hello Mr.', s2);

I advice you to use string functions from Standard.lib (LEN, LEFT, FIND etc. see 'String functions' in the manual) instead SysLibs…. (platform dependent).

One limitation: do not use the same string functions in different tasks.


PostPosted: Wed Mar 01, 2017 4:29 pm 

Joined: Tue Apr 21, 2009 2:20 pm
Posts: 3
Hi, its a very old topic but still valid. I have a question regarding the statement
do not use the same string functions in different tasks

I already found that recommendation or hint, that STRING functions from the standard library are not programmed to be reentrant.
Okay, usually its clear. But can you tell me why?
If I need STRING functions in POUs outsourced in libraries, do have to avoid the usage oif the functions from this Standard lib!?
Which should I use else?

Thank you for your support.

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+01:00

Who is online

Users browsing this forum: No registered users and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited