Spindle gear

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
bgdayton
Posts: 19
Joined: Tue Jun 28, 2011 6:47 pm
Allin1DC CNC Controller: Yes
CNC Control System Serial Number: 328110126
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No

Spindle gear

Post by bgdayton »

Thanks for the CNCM11 PLC programming manual. I am running the Centroid software. My Bridgeport has a backgear for the low spindle range and runs 1 to 1 in high gear. I need to write a plc program that will take a spindle speed command sent by the Centroid software and determine which gear to run in. The plc program should cause everything to wait for the gear change to take place. Is there an SV_PLC_FUNCTION that I call to make the system wait until the gear change takes place?
Also a question about SV_M94_M95, Do these bits call a macro in which you define. I am looking at the Allin1dcbasic plc example on page 88 of the plc programming manual in the define section as follows "M3 IS SV_M94_M95_1 ;(Spindle CW)". So would this call a macro for M3 when this command occurs in a part program? Are macros limited to G and M code?
One last question. from the plc programming manual. On page 85 there is a line from the example program for the aux 1 key of the jog panel as follows "DoAux1Key IS SV_PLC_FUNCTION_24". Is this a predefined function or is it calling a macro?
cncsnw
Posts: 3859
Joined: Wed Mar 24, 2010 5:48 pm

Re: Spindle gear

Post by cncsnw »

My Bridgeport has a backgear for the low spindle range and runs 1 to 1 in high gear. I need to write a plc program that will take a spindle speed command sent by the Centroid software and determine which gear to run in. The plc program should cause everything to wait for the gear change to take place. Is there an SV_PLC_FUNCTION that I call to make the system wait until the gear change takes place?

The PLC program is not the best tool for that. Typically you would do that in G codes (e.g. in custom M3 and M4 macro files, or in a new M function or G code macro which you call from M3 and M4).

For example, you might insert:

Code: Select all

IF [#4119 < 400 && #50012 != 1] THEN M200 "Shift to Low gear and press Cycle Start"
IF [#4119 >= 400 && #50012 != 0] THEN M200 "Shift to High gear and press Cycle Start"
These commands should come (or be called) after the M95 command that stops the spindle from its previous direction (if any), but before the M94 command that starts it in the new direction.
Also a question about SV_M94_M95, Do these bits call a macro in which you define. I am looking at the Allin1dcbasic plc example on page 88 of the plc programming manual in the define section as follows "M3 IS SV_M94_M95_1 ;(Spindle CW)". So would this call a macro for M3 when this command occurs in a part program? Are macros limited to G and M code?
Any line that contains the keyword "IS" does not perform any function at all. It just gives an alternate name to a predefined keyword. For example, the PLC compiler always knows what "SV_M94_M95_1" means: it accesses a bit that is set or cleared by M94 and M95 codes in the CNC program. The PLC compiler does not know what "M3" means. It means nothing until you define it to be synonymous with some predefined token.

If you define "M3" to mean the same thing as "SV_M94_M95_1" in the PLC program, and you ensure that an M3 code in the CNC program executes M94/1 (and that M5, to turn it off, executes M95/1), then your PLC program can look at the bit you call "M3" and know whether or not the CNC program has asked for the spindle to run forwards in auto mode.

And yes, the only things that Centroid calls "macros" are on the CNC program side: either custom M functions (files named mfuncxx.mac) or macros called with the G65 code. Nothing in the PLC program is called a macro, or acts like one.
One last question. from the plc programming manual. On page 85 there is a line from the example program for the aux 1 key of the jog panel as follows "DoAux1Key IS SV_PLC_FUNCTION_24". Is this a predefined function or is it calling a macro?
As noted above, that is just giving the name "DoAux1Key" to the predefined token "SV_PLC_FUNCTION_24". The PLC program may later choose to set SV_PLC_FUNCTION_24 when the operator presses the Aux1 key, or a keyboard equivalent. I believe this in turn causes the MPU11 to ask CNC11 to look up and initiate a special function, as described under Machine Parameters 188 - 199.
bgdayton
Posts: 19
Joined: Tue Jun 28, 2011 6:47 pm
Allin1DC CNC Controller: Yes
CNC Control System Serial Number: 328110126
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No

Re: Spindle gear

Post by bgdayton »

Is there a manual for writing custom macro files. I did not see anything in the plc programming manual on this. The example macro you gave sounds like one would have to manually shift the backgear and then press cycle start to go on. The way the original control worked was that the spindle would come to a stop then start back up at a slow jog speed. An air cylinder releases and then another air cylinder shifts the gears. The spindle needs to be at a slow jog speed so the gears will mesh. Once the shifting cylinder is in the desired gear, a prox switch makes and locks in the first cylinder that holds the gearbox into gear. The spindle in low gear is speeds 120 to 1100 rpm. High gear is from 1100 to 5000. By not having to change gears and have the machine do it automatically, I would not need to stand by the machine all the time to operate. Is there any way to get the machine to automatically do the shift and then continue in the program?
cncsnw
Posts: 3859
Joined: Wed Mar 24, 2010 5:48 pm

Re: Spindle gear

Post by cncsnw »

Yes, the control can be programmed to shift gears automatically, given a machine that is capable of doing that. It would take a combination of CNC macro programming (to decide when to initiate a gear change) and PLC programming (to manage the solenoids and switches to make it happen.

Typically the CNC macro would tell the PLC program to start the process, by setting a request bit with M94. The PLC program would handle the rest of the sequence, and would report completion by setting a chosen memory bit. After sending the request, the CNC macro would wait for the memory bit to come on before removing the request and proceeding.

There are lots of pitfalls here:
You need to ensure that the process is cancelled in a graceful manner if the operator cancels the CNC program (e.g. Cycle Cancel, E-Stop, or some other error) while a gear change is in progress.
You need to write the PLC program so it only starts the gear change sequence once, even though the M94 request will be maintained throughout the process.
You need to understand the spindle speed control section of the PLC program well enough to override the programmed spindle speed with your jog speed during your gear change, and resume using the programmed spindle speed when done.

See the M-Series operator's manual, Chapters 11-13. In particular see "Macro M functions", M94/M95, and M100/M101 in chapter 13.
bgdayton
Posts: 19
Joined: Tue Jun 28, 2011 6:47 pm
Allin1DC CNC Controller: Yes
CNC Control System Serial Number: 328110126
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No

Re: Spindle gear

Post by bgdayton »

Thanks for the prompt reply. I think a lot of the pieces of the programming puzzle are coming together.
I was having trouble opening up macros and reading them in word processors such as wordpad, notepad etc. What was displayed didn't make sense. I switched to gedit in Linux running on Unbuntu and everything comes out correctly.
My toolchanger has a carousel with five switches that give the control a rough idea which tool pocket position it is in. The carousel will index rapidly when to directional valve is pulled in but then the control sends a pulse train to the valve to move the carousel into the final position at a slow pace. There is also a switch that makes when the tool is in the final position. I was looking at the code for the gpio4d-atc-umbrella plc program and it looks like there is a tool counter switch that makes and breaks every time a tool indexes. It also looks current tool position and putback numbers are written to a file. Am I correct on the way this works? My Bridgeport uses graycode from the switches on the carousel to determine the tool position. Maybe the best way to do this is to setup a table in a plc stage that decodes the tool position. I also plan on using an opto to drive the valve for this because it is very hard on relay contacts to pulse a valve coil in this manner.
A question on stages. Is it a line such as " ;-------------------------------" this at the end of the stage that marks the end of it? Do it need any blank lines before or after the example line I gave as well?
Thanks
Post Reply