netdomain Posted January 3, 2007 Report Posted January 3, 2007 Hi, How do I use the Call function? for example ----------------------------------------[CALL P2] Now I have a subroutine called "Sub2", how do i label it so the plc knows to call it? I tried to look for Pointers/Labels, but didn't find any command for it. Help is appreciated, thanks
Gambit Posted January 3, 2007 Report Posted January 3, 2007 HI You should first program a FEND instruction. after this you can enter your subroutine program. Before the power line enter P2 end end each subroutine with a ret instruction zie pic
netdomain Posted January 3, 2007 Author Report Posted January 3, 2007 Hi Gambit, But that is within the same program. What if I create another program.. hwo would I call that? Lets say Main Routine, and then Subroutine called "Subroutine2" How would I call that? like in AB, we use JSR function.
Gambit Posted January 3, 2007 Report Posted January 3, 2007 (edited) Guess your using a system Q then. Make a program for a subroutine and with a P... in the beginning like the attachment. Finished with a RET instruction. This program should be in the parameter program files as a wait program From the standard porgram you can call the subroutine by using the CALL instruction you've already used. oke I think this you alreay know this. But there is one thing you have to change in the PLC parameters. The common pointer number indicates if the subroutine program is in the same program after an end instruction or in another program. For instance if you enter 100 for the common pointer. P0...P99 are in the same program 100 .. 4095 are in another program. Does this help?? Are you using GX Developer or IEC Developer because that is different and is only used here in Europe so far!!! Edited January 3, 2007 by Gambit
netdomain Posted January 3, 2007 Author Report Posted January 3, 2007 Thanks Gambit, it worked great :) Finally, I was going crazy over manuals.. very poorly written.
Crossbow Posted January 3, 2007 Report Posted January 3, 2007 Two notes: 1. The pointers for your subroutine instructions should be after the FEND instruction (function end) and before the END instruction. You should also code an RET at the end of each subroutine. 2. If you are referring to the SH(NA)080039 Q Common Instructions manual, they just put a new version on www.meau.com, and it's far improved over the old version. Better layout and easier to read. But it's about 50 megs.
panic mode Posted January 3, 2007 Report Posted January 3, 2007 wow... that's quite a jump from SH_NA_080039-J.PDF (19Mb) to SH_NA_080039-K.PDF (50Mb)
Crossbow Posted January 3, 2007 Report Posted January 3, 2007 But look at the difference in the readability and layout... I know they could probably compress it further, but hey, i'ts an improvement nonetheless....
panic mode Posted January 3, 2007 Report Posted January 3, 2007 agreed... btw, just upgraded to acrobat reader 8 and opened the QD75M_ manual (IB_NA_03000062). this particular manual was always a pain because of two-page tables. for some reason i could never get the facing pages to display properly side by side and i couln't find setting to fix that. but now that installation is complete i opened it just to check that out and voila, they are just the way they should be. i don't know what is different or if the previous version was somehow corrupted on my machine but i wish this looked like this last time i was programming servos...
Gambit Posted January 4, 2007 Report Posted January 4, 2007 Can you post the manual ?? I don not have access to the MEAU site
panic mode Posted January 4, 2007 Report Posted January 4, 2007 Maybe this helps: SH(NA)080039-K 50.61MB PDF QCPU(Q Mode)/QnACPU Programming (Common Instructions) you can also visit www.meau.com and avoid redirection to japaneese server if you pretend to be in USA - by using proxy server such as http://www.secure-tunnel.com/ (Google will help you find bunch of others if you like to experiment)
Veganic Posted August 21, 2009 Report Posted August 21, 2009 (edited) Anyone have a program example for calling subroutines in different files for a Q002 with CALL or ECALL? I'm ok on subs in the same file but can't seem to call one in another file. Thanks in advance. EDIT: Never mind, it is working it just doesn't show in the program monitor. Edited August 23, 2009 by Veganic
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now