Couple of questions regarding subprograms..
Let's say i make a program called Main.min. In this program I set a variable.
Then i call a subprogram. Not a subroutine, as in:
But a subprogram where i call Sub1.ssb or sub1.sub (What should i use, ssb or sub?).CALL OSUB1
[...programming continues...]
OSUB1
[...subroutine...]
RTS
-----
So here are the questions.
1. I've been doing some trial and error testing with subprograms, as i have noone to teach me. What do i write to call a .ssb or .sub program from the .min? ("Pselect" tested, "call" tested, and only writing the program name tested.)
2. How is the layout of the subprograms? Is it like subroutines where we end with RTS? How do i jump to a subprog. in the middle of the .min program, then jump back to the same spot in the .min program (Can i define where in the .min i want to return to?)
3. As i said earlier, a variable was entered in the .min (for example VC1=5), if i then jump to the .ssb/.sub and attempt to alter "VC1" there, will it still see VC1 as 5 in the subprogram?
-----
What im trying to achieve here is this:
In the .min I will always enter 2 variables at the top. (VCPARTS and VCWORK).
Then i program the machining cycles as usual.
At the end, instead of either turning the dual-pallet table and end the program, I simply run a subprogram to check if there are still parts remaining to be machined.
I know i can do this within the .min program quite easily. But just for the fun and training, i want to creat a subprogram for it.
Example of what i mean:
Then in the subprogram:VCPARTS=40 (40 parts ordered)
VCWORK=2 (Number of parts being completed for each machining cycle) (2 parts in the machine.)
-
NTOP
[...program cycle...]
-
call (<-?) count.sub
M30
Sorry for my very complex way of describing my questions/problems. Im not a native english speaker, nor very familiar with CNC machines (yet).VCCOUNT=VCCOUNT+VCWORK (VCCOUNT will be manually reset to 0 before running the program)
IF[VCCOUNT GE VCPARTS]GOTO N2
M60
[command that returns to the .min program, but also to NTOP]
-
N2
M60
[Line that returns to the .min program, and countinues where it left of] (M30)