Array of SDT as I/O on FB

4 posts in this topic


Im trying to make a fb where I have an array of sdt as an input output type. 

The reason is to have write and read access to my connected global vars inside the fb. 

This works fine in most cases. But when trying to use a bmov where moving an array of sdt input to the array of sdt I/O I get strange results. The first array element is correct. But then rest are mostly zeroes. It is writing zeroes. I tried the same outside the fb, and it works fine. 

Only thing I can think of  is that inside the fb all vars gets a local random register. Maybe this can cause it to fail?

the array of sdt input and array of sdt I/O are of same sdt type 

The sdt consist of mixed data types  

I’m using gx works 2 with a q plc 

can someone shed some light on this matter?

and will using the array of sdt as input on fb cause more execution time? I’m thinking the cpu maybe have to cope the vars to local before using them?

Share this post

Link to post
Share on other sites

1. It's imposible to answer, not seeing your program.
2. There is not neccessary to transfer an array to the FB. It's easier to define it in GVL and then to access to its elements inside the FB by array index.

Share this post

Link to post
Share on other sites

1) not sure why you need to see the programme. It’s a general question about working with sdt. 

2) so you’re saying to access global vars directly from inside the fb? Instead of adding locals to work with them?

to break it down...

I create a sdt named recipe

i create 2 global vars.

var1 = of recipe

var2 =array(1..7) of recipe

I then create a fb with 1 input = sdt (recipe)

and 1 input/output = array(1..7) of sdt(recipe) 

What I want to do. Is to bmov the input vars to the input/output vars. Which doesn’t work. 

On the other hand. If use a move on a single var from the sdtit works fine. 

Share this post

Link to post
Share on other sites

Se this is what you have in your FB. Works fine 


Edited by Gambit

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