naj.keclv

GX Works 2 + FX3U array of sdt & fb in another fb

6 posts in this topic

Hello everybody,

i have some uncertainties going through my head. i am fairly new in PLC word, graduated last year, last 12 month i did project on Siemens PLCs, but now i have to expand my view with Mitsubishi.

1.

i am working on project with several conveyors. for each conveyor type i have FB fairly similar to my FB in siemens. For all conveyor i am using same sdt containing 32 bits. So a have array[0..20]  of said sdt. But in fb i was not able to copy item from array, through input var containing index of that item to vocal variable, which i wanted to write back to the array at the end of fb. I tried different approach ->  using item from array *** input/output.  When monitoring item from array i can see, that variables i change in got2000 panel are in fact changing. But when i monitor fb itself, those same variables are not changing.

i reworked this fb several times, for example when i found out that FB variables FB FXcpu cannot be set as retain so i would like to use it and i see no other way than make this fb work. :D

2. Is there possibility to us FB in another FB? I remember that i read some restriction about this, but now, i cannot find it.

Thank you everybody for your responses

 

 

Edited by naj.keclv
more specific title

Share this post


Link to post
Share on other sites

1.  Can you attach a small example project. then we can take a look at where you are going wrong.

2. Yes it is possible to use a FB in a FB in a FB etc, If you want to use a label from inside a FB just use the nameFB.nameFB.labelname

Share this post


Link to post
Share on other sites

Hello again,

so as in/out i use db_MVT[2] (it is 32 bit) cyan blue in first picture, and variable HS_L of db_mvt[2] is currently logic 1. But in function block it does not reflect. As when i monitor fb with correct insatance it shows logic 0.

Screenshot 2021-04-09 093819.png

Screenshot 2021-04-09 093902.png

Share this post


Link to post
Share on other sites

strange, but it is defined as an inout. could it be that it is reset in the FB itself ?

Share this post


Link to post
Share on other sites

no, the variable is only used as read. But i might delete array of sdt and replace it with several sdts. Because i do not have good experience with arrays and gx works 2. :D and those two for loops i will just rewrite manually as the array itself is not that big, only twenty elements. or i will use of index registers.

Share this post


Link to post
Share on other sites

So apparently, gx works 2 cannot handle an instance of array as an input to function block.

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