9/17/2010 2:18 AM | |
Joined: 10/7/2005 Last visit: 7/30/2024 Posts: 3013 Rating:
|
Hello Captive Engineer I must say I can onlyspeculate right nowand wish you would have uploaded the whole FB (or better a whole S7 program with an example call of it). Nevertheless, here are a few ideas on what to check: 1.) Confirm that you use STAT variables of the FB to store the DB number (if they are TEMP's it must fail) 2.)Please let us know what the purpose of the "JZldna"commandis. This "Jump if Zero" will cause a jump over the "OPN DB" command if true. Since the JZ command depends on CC 0&1 status (not on the RLO)it isas such is influenced by all sorts of instructions (shifts, math instructions etc) If you execute NW 1, the "/I" that you have in it will (hopefully) give you a quotient of <> 0, so the "JZ" instruction in NW 2 will NOT lead to a Jump and your code works. If however you do NOT execute NW 1 (i.e. #x_Data_Link_Init bit is TRUE), you are at the mercy of the whatever last instruction manipulated CC0 & 1 (i.e.there is a goodchance that "JZ" is executed and a jump over the "OPN DB" command takes place) Last but not least, indirect access to IDBvariables in an FB is best done taking the Multi Instance offset in AR2 into account (otherwise your FB will fail to work if called asa Multi Instance). Have a look at the end of THIS FAQ on how to take AR2 into account for this. I hope this helps (and if not, pelase upload the whole FB with example call here) |
Last edited by: fritz at: 9/17/2010 2:21 AMCheers |
|
This contribution was helpful to
1 thankful Users |
9/17/2010 3:39 AM | |
Joined: 1/30/2006 Last visit: 6/25/2024 Posts: 103 Rating:
|
Thank youkindly for looking at this, Fritz, and for your thoughts so far. AttachmentHeat_t_2.zip (62 Downloads) |
9/17/2010 4:31 AM | |
Joined: 10/7/2005 Last visit: 7/30/2024 Posts: 3013 Rating:
|
Hello again Captive Engineer that'll certainly work ok, even though I would personally have useda "JC" instead of the "JZ". Having said that, you may want to consider to complete remove the DB number check logic (which is what I would do) and always execute "OPNDB[#w_DBN]" (irrespective if your ANY Pointer nominates a DB area or not). "OPNDB[#w_DBN]" witha DB numberof zero will simplyclear the DB 1 register (i.e. no DB is open anymore via the DB 1 register), but will not cause an error (note that your user program will also never have a DB 0 as Step 7 does NOT allow youto create or use a DB 0). I hope this helps |
Cheers |
|
9/17/2010 3:04 PM | |
Joined: 10/7/2005 Last visit: 7/30/2024 Posts: 3013 Rating:
|
Have a secondglance dear bit7and I'm sure you'll agree that: a.) the problem wasn't mine but Captive_Engineer's b.) "#x_Data_Link_Init" wouldindeed have beenset because its (quite far) behind a "JC" command which SET's the RLO (and all the AR1 related logic in between doesn't affectthe RLO) c.) Captive_Engineer's real problem had already beensolved |
Cheers |
|
Follow us on