Hello Guest it is April 10, 2021, 07:29:39 PM

### Author Topic: Setting Motor Counts Per Unit in macro  (Read 4675 times)

0 Members and 1 Guest are viewing this topic.

#### Mauri

• 320
##### Re: Setting Motor Counts Per Unit in macro
« Reply #30 on: January 14, 2018, 05:48:07 PM »
Craig,
Yes I do have speed limits on my spindle set in Mach4 8000 min and 24000 max.
Are there any # variable that contain Velocity for the A Axis motor or is there a Fspeed # variable for A Axis?
Regards,
Mauri.

#### joeaverage

• 6,384
##### Re: Setting Motor Counts Per Unit in macro
« Reply #31 on: January 14, 2018, 05:57:16 PM »
Hi,
yes speed limits no problem but not angular limits, angular limits don't make any sense on a free running axis.

I imagine there are pound variables for velocities etc but I don't know what they are at the moment.

Still, the bottleneck at the moment, is being able to control an out of band axis in absence of the spindle APIs.
Without that capability you would lose simultaneous  control of your main spindle.

Craig
My wife left with my best friend...
and I miss him!

#### joeaverage

• 6,384
##### Re: Setting Motor Counts Per Unit in macro
« Reply #32 on: January 14, 2018, 08:06:55 PM »
Hi,
think I may have found the problem, according to this document Mach4Hobby is limited to one out of band axis.

Craig
My wife left with my best friend...
and I miss him!

#### Mauri

• 320
##### Re: Setting Motor Counts Per Unit in macro
« Reply #33 on: January 14, 2018, 09:27:35 PM »
Craig,
This is what I would like as lua script to make this work.

local surfacespeed=mc.mcCntlGetPoundVar(inst,2134)
if spinspeed>=1500 then spinspeed=1500 end

local mInst = 0;
local param = number for A Axis Velocity ;
local value=A Axis Velocity (spinspeed);
mc.mcCntlSetPoundVar(mInst, param, value);

This would be an ideal way of having variable A Axis speed based on Z Axis radius.
However it may not work for 2 reasons.
1) There may not be any # Variable for A axis Velocity.
2) If there is it may not be allowed to be used while processing the G-Code or it may take affect after the next move as it does with #2134.

If there are any experts, on this, out there it would be great if they gave us some help.

Regards,
Mauri.

#### joeaverage

• 6,384
##### Re: Setting Motor Counts Per Unit in macro
« Reply #34 on: January 14, 2018, 10:36:16 PM »
Hi,
that is very similar to the code I've already posted.

Note that for the purposes of  a variable speed A axis the A axis will temporarily become the spindle and your main
spindle becomes uncontrolled. This is a consequence of only being able to have one out of band axis in Mach4Hobby.

The code I posted uses the current feedrate, ie pound variable 2134. Note that the interpretation given to that number
is SURFACE SPEED. You could set it by issuing a Fnnnnn where nnnn is your desired surface speed but would also
secondarily double as the feedrate for the linear coordinated axes as well. Thus the normal feedrate interpretation
would change for the duration of the A axis assuming the nature of a spindle.

If however you wish to have a different value for surface speed you could pass that to Mach as a parameter.
Another alternative would be to have the desired surface speed in a persistant register.That number
could be manipulated to determine an angular speed. To my knowledge the only way to ensure that angular speed is reflected
at the spindle is mc.mcSpindleSetCommandRPM().

The advantage of passing surface speed as a parameter or using a register is that the feedrate F, will be consistent for your
linear axes.

Quote
mc.mcCntlSetPoundVar(mInst, param, value);
This sets a pound variable it does not ensure that the spindle will adopt that speed.

Craig
My wife left with my best friend...
and I miss him!

#### Mauri

• 320
##### Re: Setting Motor Counts Per Unit in macro
« Reply #35 on: January 15, 2018, 05:21:13 AM »
Craig,
At this stage I will give up and wait for the Mach4 programmer to make the code in Mach4 to perform the same action as Mach3.
I will have to see if I can modify the controller to be able to run both Mach3 for 4 Axis and Mach4 for 3 Axis on our Router Table using ESS.
At present we are using USS.
Regards,
Mauri.

#### joeaverage

• 6,384
##### Re: Setting Motor Counts Per Unit in macro
« Reply #36 on: January 15, 2018, 09:10:54 AM »
Hi Mauri,
I think you'll be waiting a long time. NFS might reasonably claim that the tools have been provided for you to program your installation so that it behaves
in a manner that you determine.....if you can't or don't want to use those tools?

Craig
My wife left with my best friend...
and I miss him!

#### Tony Bullard

• 176
##### Re: Setting Motor Counts Per Unit in macro
« Reply #37 on: December 07, 2018, 11:58:18 AM »
Does the latest change to Mach4 address all the issues of this discussion?

From the change log.
"3804 - 3786
Mach4GUI: Get Parent
Core: Prevent rotary axis unit conversion.  mcAxisSetPos() would do a units conversion on any and all axes.  But mcAxisGetPos() always returned the axis position in native machine units.  mcAxisSetPos() was changed to always use native machine units (the original design intent).
Mach4GUI: Prevent rotary axis unit conversion. All DRO display and entry unit conversions are handled in the GUI.
Core: Prevent F from being affected by a unit conversion if it is used on a line with a rotary axis ONLY.

Thanks for all the help.

#### joeaverage

• 6,384
##### Re: Setting Motor Counts Per Unit in macro
« Reply #38 on: December 07, 2018, 12:39:38 PM »
Hi Tony,
this thread is a few months old and in an earlier post I stated that Mach4 Hobby could only have one out of band axis according

I have subsequently been informed by smurph that Mach4 Hobby does support all six out of band axes.

I don't think it bears on the problem you are talking about but thought I should correct the record.

Craig
My wife left with my best friend...
and I miss him!

#### Tony Bullard

• 176
##### Re: Setting Motor Counts Per Unit in macro
« Reply #39 on: December 07, 2018, 01:04:42 PM »

Thank you Craig. I'm back to the opening statement of this discussion.
"I’d like to change the Motor3 Counts Per Unit based on the diameter of work on a rotary axis." In my case I'm rotating a piece of pipe and cutting a profile on the end with Plasma on the Y axis. My code might be "G01 Y1 A2" where Y is inches and A is degrees. To get the vector velocity correct I need to change degrees to inches. The diameter will determin that. I'm hoping now to add a DRO for the diameter and code to update the Counts Per Unit for Motor3.

It has been so long that I've worked with code that I'm going to have to start all over again.