Some screen buttons for Lathe spindle control
My lathe has two MPGs for controlling the axes and like this it can be used for manual turning as easily as a true manual machine. This means I need manual control of the spindle speed.
This case study shows how two custom functions can be added to a turn/lathe screen set to make manual control of the spindle be easier. They are intended for use on a touch screen but would work as well with a trackball or mouse.
There are two new functions.
- The Up/Down arrows for the S word apply a geometric change rather than adding or subtracting a fixed amount. This is like the gearbox rations of a conventional lathe. The slow speeds are closer together; the fast speeds widely spaced.
- I have added a button to toggle in and out of Constant Surface Speed mode. This mode is very useful if facing large diameter stock.
The screen looks like this
Geometric speed setting
The buttons for manually raising and lowering the spindle speed have the following VB Script on them
Const MFactor = 1.2 ' geometric multiplier factor If not GetOEMLed (107) Then ' not in CSS S = GetDRO (17) S = S / MFactor If S < GetOEMDRO (121) Then S = GetOEMDRO (121) ' clip speed SetDRO 17, S End If
Const MFactor = 1.2 ' geometric multiplier factor If not GetOEMLed (107) Then ' not in CSS S = GetDRO (17) S = S * MFactor If S > GetOEMDRO (57) Then S = GetOEMDRO (57) ' clip speed SetDRO 17, S End If
This button changes mode (I could never remember which G code was CSS and which normal) while retaining approximately the same actual spindle RPM at the time of change.
The script is
If GetOEMLED (107) Then ' in CSS mode S = GetDRO (17) ' get current speed code "G97 S" & S ' switch to normal mode Else ' in normal mode S = GetOemDRO (117) ' get current speed code "G96 S" & S ' switch to CSS with appropriate speed End If