11/23/2011 10:10 AM | |
Joined: 8/31/2005 Last visit: 9/12/2025 Posts: 2198 Rating:
|
Use theIN and OUT part of the FB to define inputs and outputs. AttachmentForum.pdf (359 Downloads) |
|
|
11/23/2011 2:59 PM | |
Joined: 1/28/2009 Last visit: 8/31/2025 Posts: 6874 Rating:
|
Dear sakal123 , Indirect addressing would be a great help to access local variables inside FB and while FB called as Global variable.Check the following link for more information on "Indirect addressing". ![]() Best regards, Hamid Hosseini |
11/23/2011 5:33 PM | |
Joined: 8/31/2005 Last visit: 9/12/2025 Posts: 2198 Rating:
|
Due I don't know what is in your marker words, I cant answer. I attached a file, that shows how I would make a FB that multiplies a time with a factor. AttachmentFB1.zip (322 Downloads) |
|
|
11/24/2011 8:21 AM | |
Joined: 10/7/2005 Last visit: 9/10/2025 Posts: 3049 Rating:
|
Hello sakal123 miamialready showed you very nicely how to handle the S5Time format, in case you still need an answer for your original problem, Isuggest you keep it as simple as shown in the attached pic. The "trick" is that the "ITB" command (Integer to BCD) only evaluates accu 1 L (the low word of accu 1) which of course has the same contents as you have in"MW318" in your original program. As such thereis no need to try to acccess part of an Instance DB DINT, nor do you need to go down the path of indirect addressing (for which you would also have to take the AR2 offset into account in a Multi InstanceFB by the way). The logic in NW2 can also be done in LAD or FBD, just make sure you untick "Type check of addresses" (see Options menu --> Customize --> LAD/FBD tab). One last thing, I'd use TEMP variables for any intermediate results instead of STAT's. I hope this helps |
Cheers |
|
11/24/2011 2:46 PM | |
Posts: 29 Rating:
|
Thank you all for now! You have been really helpful! |
This contribution was helpful to
1 thankful Users |
Follow us on