Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Steelbarz on March 18, 2024, 11:57:04 AM

Title: Script to Orientate Spindle
Post by: Steelbarz on March 18, 2024, 11:57:04 AM
Does anyone have simple code or a macro to orient a spindle to a certain position.  My axis has encoders and spindle index signals all working and Mach4 can see them.  I can accurately control the spindle to 1rpm

I have Mach4 and ESS/MB3 if it helps

I would like it to do something like this:
Rotate spindle CW at 10rpm and when the index signal is high stop (effectively 0 degrees) then rotate spindle 90 degrees and stop and lock the spindle.

Title: Re: Script to Orientate Spindle
Post by: GOOMBA on March 19, 2024, 09:10:02 AM
Here is an example of the orientate macro we're running on one of our mills.
Title: Re: Script to Orientate Spindle
Post by: Steelbarz on March 19, 2024, 02:32:41 PM
Here is an example of the orientate macro we're running on one of our mills.

Thank you, That gave me the code to start and stop very helpful, but I still cant get it to stop on the index signal
Title: Re: Script to Orientate Spindle
Post by: arturod on March 22, 2024, 08:38:01 AM
Check how we a servo on the spindle here:
https://www.cnc4pc.com/blog/post/configure-an-step-and-direction-servo-as-spindle-on-mach4-using-the-ethernet-smooth-stepper-and-c82
Title: Re: Script to Orientate Spindle
Post by: Steelbarz on March 22, 2024, 10:13:15 AM
Check how we a servo on the spindle here:
https://www.cnc4pc.com/blog/post/configure-an-step-and-direction-servo-as-spindle-on-mach4-using-the-ethernet-smooth-stepper-and-c82

Thank you, that was last week's problem...lol just getting the spindle to work.  But now I am hoping to control the spindle so that I can position its orientation a set number degrees off the index mark.