Step7 - How to use UDT as inout in a FB?

Weo

Member
Join Date
Feb 2006
Location
Sweden
Posts
82
Hi All,

Can anyone help with my problem and you save my day ..

I´ve made a FB which I am to use as a multi instance.
I want to pass data in/out of this FB and therefore I made a UDT with the structure of the data.

In the FB I declare a new inout with datatype of the above UDT, I´m using an inout since there are data which I should both read and write to in this struct.
I made the code in the FB, so far so good ..

Next step I called the FB above from another FB, but when trying to declare data at the actual inoutI all time get a fault that says the data on the actual side are not matching the data in the FB I call.

I really don't know how to write the adress of the DB where I use the above UDT.
I tried with the start adress of first parameter and also in pointer format but without success. The length of the data I want to pass are 18 Byte.
What am I doing wrong?o_O

Using the data inout as a UDT will save me alot of time, but right now I just don't get it!

Thanks.

 
It´s working fine when declaring the UDT just as IN, but since
I need to write some data also I wanto to use IN_OUT.
One solution is to make one UDT for IN and one for OUT, but prefer to know what I´m doing wrong and use IN_OUT.

Hi All,

Can anyone help with my problem and you save my day ..

I´ve made a FB which I am to use as a multi instance.
I want to pass data in/out of this FB and therefore I made a UDT with the structure of the data.

In the FB I declare a new inout with datatype of the above UDT, I´m using an inout since there are data which I should both read and write to in this struct.
I made the code in the FB, so far so good ..

Next step I called the FB above from another FB, but when trying to declare data at the actual inoutI all time get a fault that says the data on the actual side are not matching the data in the FB I call.

I really don't know how to write the adress of the DB where I use the above UDT.
I tried with the start adress of first parameter and also in pointer format but without success. The length of the data I want to pass are 18 Byte.
What am I doing wrong?o_O

Using the data inout as a UDT will save me alot of time, but right now I just don't get it!

Thanks.
 
just two cents why don´t you use an Add On Instruction that includes your FB, they have input data, output data and parameters, you can use it as many times as you want
edit:sorry, my answer is related to rslogix 5000 only
 
Here a short example project using the principle you have described and an associated screen shot:

attachment.php
 
Last edited:
hello ihave small problem ihave program for convoyer belt to filling buttle by water . convoyer start move until buttle under the valve stop and valve start after buttle full convoyer go to com again buttle . my program dont stop or stop after full buttl and dont move again please help mee thans
 
Thanks for your help, your example is just what I wanted to achieve and how my program is done.
I got it working first when I did like this:

1.Declared the UDT as only IN in my FB
2.Where I call the FB above I type the data (DB15.Dog)
3.After that I changed to IN_OUT and now it´s no conflict anymore.

So really don´t know why it´s not working when I declare as IN_OUT at first place, but anyway .. it looks good now so I guess case is closed.

Thanks for help
 
Hi Co2,

I suggest you start another thread about this, your question are not related to the one I started this thread with.

hello ihave small problem ihave program for convoyer belt to filling buttle by water . convoyer start move until buttle under the valve stop and valve start after buttle full convoyer go to com again buttle . my program dont stop or stop after full buttl and dont move again please help mee thans
 
Hi All,

Can anyone help with my problem and you save my day ..

I´ve made a FB which I am to use as a multi instance.
I want to pass data in/out of this FB and therefore I made a UDT with the structure of the data.

In the FB I declare a new inout with datatype of the above UDT, I´m using an inout since there are data which I should both read and write to in this struct.
I made the code in the FB, so far so good ..

Next step I called the FB above from another FB, but when trying to declare data at the actual inoutI all time get a fault that says the data on the actual side are not matching the data in the FB I call.

I really don't know how to write the adress of the DB where I use the above UDT.
I tried with the start adress of first parameter and also in pointer format but without success. The length of the data I want to pass are 18 Byte.
What am I doing wrong?o_O

Using the data inout as a UDT will save me alot of time, but right now I just don't get it!

Thanks.

hello weo can you help me . ihave small program to filling buttles by water . convoyer belt start move and if the buttle arrive under the valve the belt stop by photo sensor swith .after buttle full the belt move by level switch . and com another buttle . my problem is the belt stop afer full buttle and dont move again or the valve start befor the buttle please help me
thanks
 
Hello Co2;
Look at the following attachment, it will show you where to look for the "New Thread" selector. This will enable you to broadcast your question to many more users, and probably get a more varied collection of answers.

You state:
ihave small program to filling buttles by water . convoyer belt start move and if the buttle arrive under the valve the belt stop by photo sensor swith .after buttle full the belt move by level switch . and com another buttle . my problem is the belt stop afer full buttle and dont move again or the valve start befor the buttle please help me
Now, for anyone to help you out, we would need more information, like the make and model of the PLC you are programming, the type of logic you are using for the restart of the conveyor belt, an idea of your operations logic (which step follows the other, and the interlocks between them).
Hope this helps,
Daniel Chartier

ThreadStarter.JPG
 

Similar Topics

Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
141
Hopefully someone can validate my thoughts on the following: I'm looking at a proposed program design for a line which will be with us early next...
Replies
13
Views
7,069
I have some data in a FB. Said data is visible in the FB's DB. I would like to have this data in a UDT and then move it to another location...
Replies
13
Views
9,973
What are UDTs and What is their significance in step7????? Thanx in advance for any help....
Replies
2
Views
2,886
Hello. I have searched the forum and did not find the answer for this: I am using a S7315-2DP plc. I have made one prgram that uses udt's as...
Replies
4
Views
6,494
Back
Top Bottom