10/1/2013 4:19 AM | |
Joined: 10/7/2005 Last visit: 11/1/2024 Posts: 3025 Rating: (1055) |
Hello abbeyman Local data is NOT retentive and "lost" once the FC execution is finished. As such you MUSTinitialise local data (write to it first)before you use it (read from it)and can NOT use it as the falling edge memory bit for your ----(N)---- instruction. The solution is to either use an IN_OUT variable or an M or DB bit. I hope this helps and you'll also find more info on this matter inthe threadIs it ok to use P_Trig instruction in an FC? |
Cheers |
|
This contribution was helpful to1 thankful Users |
1/30/2015 8:02 PM | |
Posts: 15 Rating: (0) |
Dear all, By the way, I also have a problem using Input/Output variable & Output variable in a FC block. I have attached the pdf file of my program below. In my program, I have declared "#Finish" as output parameter and my program is run wrong when I call many FC block. And I am trying to declare it as Input/Ouput variable, my problem was solved. Can someone tell me please what the differences are between input/output variable and output variable in FC? Why my program have a problem when I declare "#Finish" as output? Thanks for your answers! AttachmentCompare_time_function.pdf (262 Downloads) |
1/31/2015 1:17 AM | |
Joined: 10/7/2005 Last visit: 11/1/2024 Posts: 3025 Rating: (1055) |
Hello consair further to eisenpferdreiteranswer, have a look at the thread FC "out" parameter with DBX for moredetails on why and when FC Outputs can "misbehave" if they are "misprogrammed". |
Cheers |
|
This contribution was helpful to1 thankful Users |
1/31/2015 3:00 AM | |
Posts: 15 Rating: (0) |
Thanks for your helpeisenpferdreiter,fritz Now I really understand it.In the future I will stick to the "Golden Rule".
|
This contribution was helpful to1 thankful Users |
1/31/2015 4:22 PM | |
Posts: 15 Rating: (0) |
Dearfritz I think I have just understand all of them. But when I tested 2 examples that attached below. I still confuse when use #output parameter in FC block and no longer be confident when use #output parameter. :) I have 2 example: - The first, to caculate running time of pump, I called about 50 times in FC block. I used #Sum_Time(h) and #Sum_Time(m) type #output parameter, it worked wrong. (I solvedwith the change to IN_OUTparameter) - The second, to scale sensor value.I called about 20 times in FC block. It workedbeautifully. It is contrary to my initial forecast. Can you help me why the second example work good? Thanks a lot. Consair90 AttachmentRunning_Time_Function.pdf (222 Downloads) |
1/31/2015 4:24 PM | |
Posts: 15 Rating: (0) |
I am sorry, I attach the first example again When do you often use #output parameter? Can you share it?
Regards, AttachmentRunning_Time_Function.pdf (233 Downloads) |
Last edited by: consair at: 1/31/2015 5:09 PM |
|
Follow us on