Author Topic: POU Input output  (Read 5213 times)

Offline macbahi

  • PLUS+1 Guru
  • *****
  • Posts: 125
  • Karma: +1/-0
POU Input output
« on: May 09, 2022, 05:31:53 PM »
HellO,

I use POU  Structured text function as using in video #21.  It's working.

But my idea it's to use this function many times.  It can be used to calculate any things as simple example: Sum of 2 variables.

Function Sum
VAR_INPUT
     INT1  INT
     INT2  INT
VAR_OUPUT
     Out2  INT

Code
   Out2 := INT1 + INT2;


But When I call from call POU I must make the input and output as in function. In my example function are INT1, INT2 and Out2.
If other name variable  as data1,  data2  and Sum1 problem with compilation.

Please have idea how we can use POU structured text call without using the same name as input and output in function.

Thank you very much

Cordialy
Mac bahi

Offline FluidPowerTom

  • PLUS+1 Guru
  • *****
  • Posts: 363
  • Karma: +33/-0
Re: POU Input output
« Reply #1 on: May 09, 2022, 07:59:01 PM »
In this case the variable names on the input and output busses for the POU will need to be INT1, INT2, and Out2. 

What you can do is don't connect the input bus and output bus from the POU to your main busses.  Instead, for example, connect your input signal 'Signal1' by itself to the input bus of the POU, and then rename it on that bus as INT1.  So you'll have just the green wires going to the input bus and output bus of the POU.  Does that make sense?
Controls Engineer
Hydra-Power Systems

Offline macbahi

  • PLUS+1 Guru
  • *****
  • Posts: 125
  • Karma: +1/-0
Re: POU Input output
« Reply #2 on: May 10, 2022, 05:58:50 PM »
Thank you Tom