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 Sun Oct 21, 2018 7:07 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
 Post subject: VAR_OUTPUT
PostPosted: Fri Dec 29, 2017 8:38 pm 
Offline

Joined: Fri Dec 29, 2017 3:41 pm
Posts: 1
I made a FB type and do some calculation on some array inside the FB.
I would like to expose this array to the "parent" POU.
Currently the array is defined inside a VAR block (like MyArray:ARRAY[0..99] OF WORD)).
Is it possible to make this variable visible from outside by some attribute or something similar?
Alternatively, can a pointer to an array defined outside the FB be used instead of a local variable?


Top
   
 Post subject: Re: VAR_OUTPUT
PostPosted: Thu Jan 25, 2018 6:14 pm 
Offline

Joined: Sat Jan 02, 2010 2:05 pm
Posts: 94
You've answered yourself in the subject of your question...

From the external part of the code you can write something like yourfunctionblockInstance.YourArray to access the array freely.

If the array declaration is in the normal var or var_output areas you'll not be able to modify it from outside (which is always a good thing regarding design and peace of mind when you are programming).
If you want to modify that array from outside you have to declare it in the VAR_INPUT area.

Of course another approach would be using a pointer and pointer arithmetics to find the next positions of the array like you'd do in any high level language.

Good luck!

_________________
http://www.robotecnik.com - robots, CNC and PLC programming.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 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