Sign in to follow this  
Followers 0
netdomain

CALLING SUBROUTINE IN MITSUBISHI

13 posts in this topic

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 by Gambit

Share this post


Link to post
Share on other sites
Thanks Gambit, it worked great :) Finally, I was going crazy over manuals.. very poorly written.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
wow... that's quite a jump from SH_NA_080039-J.PDF (19Mb) to SH_NA_080039-K.PDF (50Mb)

Share this post


Link to post
Share on other sites
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....

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
Can you post the manual ?? I don not have access to the MEAU site

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
Thanks for the Tip!!!!

Share this post


Link to post
Share on other sites
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 by Veganic

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0