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 Wed Jun 19, 2019 7:50 pm

All times are UTC+01:00

Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Sep 19, 2018 12:55 pm 

Joined: Tue Sep 11, 2018 7:59 am
Posts: 5
hello ,
I am New In PLC programming And I Need Help.
I have Array Of DINT Which I want to Convert Into STRING Or ARRAY Of STRING , How Can I Do it ?

Thanks a Lot :)

PostPosted: Wed Sep 19, 2018 1:57 pm 

Joined: Tue Jun 26, 2018 1:31 pm
Posts: 18
see its so simple

no need to use any conversion

codesys is best for this

you just define dint variable at some physical address

define string array on the same address thats it

e.x Dintarray: array[0..30] of DINT AT %MDW100;
Dintarray_STRING: array[0..30] of STRING AT %MDW100;

PostPosted: Wed Sep 19, 2018 8:38 pm 
User avatar

Joined: Fri Jan 19, 2018 3:38 pm
Posts: 69
Allthough TurckOne's suggestion will work, it would be wiser to avoid any hardcoded memory adresses.

Instead you can use a more modern approach via a UNION for this kind of operations as it is meant for this.
I'd suggest something like the following example;
TYPE myUnion:
    ardiMyArr : ARRAY [0..4] OF DINT; // 16 byte
    sMyString : STRING[16]; // 16 byte

See CODESYS help on UNION datatypes;;product=codesys;version=

(Scroll down for my projects)

PostPosted: Thu Sep 20, 2018 1:00 am 

Joined: Sun Jun 28, 2015 12:23 pm
Posts: 84
Inside a FOR loop...
StringArray[i] := DINT_TO_STRING(DintArray[i]);

PostPosted: Fri Sep 21, 2018 2:51 pm 

Joined: Mon Oct 01, 2012 8:33 am
Posts: 50
If you want to convert the numeric value of each DINT array element then use ph0010421's method. If the DINT array contains ascii data then use Aliazzz's method.

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

All times are UTC+01:00

Who is online

Users browsing this forum: No registered users and 7 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