TIA Portal v18: Function call has Two returns - why?

Mas01

Member
Join Date
Oct 2020
Location
Leicester, England
Posts
1,109
I created this FC and it compiles, but when I use it in my MAIN OB1, it appears to have two outputs. See pictures.

What am I doing wrong here?

Thanks

function - one ouput.png function - two returns - why.png
 
Now you understand a function versus a function block, it has a return parameter this is standard & it's symbol is the name of the function.
Function blocks do not return value(s) by default you add OUT or IN/OUT pins.
 
Now you understand a function versus a function block, it has a return parameter this is standard & it's symbol is the name of the function.
Function blocks do not return value(s) by default you add OUT or IN/OUT pins.

Yes mate, I think I'm starting to understand this now...famous last words.
 
I'd remove the "always true" tag from inside the FC, it's not needed.

Good practice for reusable FCs to not have any "global" tags referenced inside. Everything should be passed in from outside.
 
I'd remove the "always true" tag from inside the FC, it's not needed.

Good practice for reusable FCs to not have any "global" tags referenced inside. Everything should be passed in from outside.

Yes, thanks - I removed it after posting this question.
Good catch though.
 
Good practice for reusable FCs to not have any "global" tags referenced inside. Everything should be passed in from outside.

On the Siemens programming courses they tell you repeatedly about this for IEC compliance. I gather you'll lose a lot of marks in the accreditation exam if you use non-compliant blocks in your code.
 
Furthermore you dont need that bit, and if you'll need in other functions you can just use constant 0 or 1 from TIA V17 (if I remember right)
 

Similar Topics

hello every one. i'm new to tiaportal, i have created new project and HMI screen the program works fine with PLC-sim, but when i try to cntrol the...
Replies
9
Views
415
My PLC (S7-1200) and HMI (KTP-1200 Basic) has been delivered on-site to the customer. To be able to do "off-line" updates to the code, I am using...
Replies
4
Views
224
hi everyone. i hope you guys are doing great. i am trying to built communication between aveva intouch hmi 2023 and tia portal v18. i dont have...
Replies
1
Views
568
Hi, My PLC hardware has been delivered to customer site - many thanks for the invaluable help on this forum! I was looking into see if it's...
Replies
12
Views
2,511
Tia portal v18 issue,online icon greyed out but plc comms must be established as.blocks showing and no offline copy on laptop.
Replies
7
Views
1,107
Back
Top Bottom