Mitsubishi ST help

Foo Fighter

Member
Join Date
Oct 2011
Location
Ontario
Posts
4
I'm looking for some help trying to figure out how to call subroutines in structured text using GX Works2.

I'm new to ST (have done a little C prog before) and am trying to write some useless programs just for practice. I've searched and searched (forums, manuals, tutorials, even CD based tutorials from Melsoft...) and cannot find what I'm looking for. :mad:

I just want to know the proper syntax for calling subroutines either using the CALL() or CJ() functions. I cannot for the life of me figure out how to create a pointer that it will jump to.

Any help would be appreciated, I'm running out of hair to pull out!

- Adam
 
Hello,

I'm not sure if this will help you but I have called a pointer to a subroutine using an FX PLC in the past but I programmed it with ladder, not ST.
In any case you would call the pointer e.g. call P1.
Then before the END instruction, you would put a FEND command. After the FEND command you would put the P1 on the left side of the ladder outside the vertical line. Enter your subroutine here followed by a SRET command to return to the main program. After that would be the END command.

Hope this helps some...

-Dave
 
Dave,

Thanks for the quick reply! Greatly appreciated

I have successfuly implemented the same logic in ladder with GX2, but for some reason I can't figure out how to get it to translate to ST. I was able to use the pointers in the exact way you have described. Pn goes beside the ladder (the text input for that is "P1;"

So this what I tried doing in ST as well. I have my main program which contains a line

CALL(0, P1);

and ends with the line:

FEND(0);

Then the subroutine begins:

P1;
LOGIC LOGIC LOGIC;
RET();

This made sense to me, since that's how it worked in ladder... but no such luck. Any other ideas?

- Adam
 
After digging through another set of manuals, I have discovered that certain data types are not available in structured text programming mode. Specifically Timers, Counters, Retentative Timers, and... wait for it... Pointers.

So now my question becomes:

How do I use subroutines? I figure that I must have to actually create individual program files for each routine, but how do I call/trigger them without using a CALL() function?
 

Similar Topics

Hi can you help, have a book stitching machine with collates pages in 8 stages. I have installed a camera system that will give an input to...
Replies
24
Views
1,891
Is there an output or something that is similar to a screen saver, but you can use in the plc to know when the user is actively using it...
Replies
1
Views
502
I have a Mitsubishi FX2N-64MR-UA1 processor. The 1st analog output card is an FX2N-4DA. It requires 24VDC power. That card is obsolete. The card...
Replies
1
Views
1,576
I have the FX2N-4DA analog output module and I am trying to send a value to one of the channels to give me a 0-10v output. Does anyone have any...
Replies
4
Views
1,394
Back
Top Bottom