Hello Guest it is December 10, 2019, 05:28:34 PM

Author Topic: Mach3, PC with standard Paralel port working, just like to confirm input speeds  (Read 955 times)

0 Members and 1 Guest are viewing this topic.

I have been pestering Hood with a few questions via another group and I wonder if Art, Brian or anyone could just verify a few things for me?

I had picked up from somewhere, possibly here, that the typical input pins are read at a speed of 10 Hz or every 100ms.  I may have got this from a macro timing so again unsure.

Hood remembers discussing similar around 10 years ago and believes that the THC inputs and probe inputs are a lot faster, and are done at 25,000Hz or every 40 uS (25,000 Kernel speed), this could tie in with the debounce period but to me only if all input pins are done at 25,000Hz.

Can anyone assist me with this just for a better understanding. I have searched through the Mach3 pdf's and not found an answer, only the debounce which says it changes with kernel speed and does not seem to differentiate between inputs.

Many thanks

Adrian
Hi,
Mach3 inputs are polled at about 10Hz known as the macro pump rate.

Machs inputs are not suitable for inputs which change very quickly, THC would be one example. Another would be the index signal from a spindle, even
a lathe spindle at only 300 rpm for threading has an index pulse every 5ms. This signal is used among other things to synchronise the start of the thread.
Mach needs to respond positively in something under 1/2ms to have any chance of being accurate.

Machs normal inputs are way way to slow to be of use in those circumstances.

Those high speed/critical timing signals are handled by the motion controller.

If you use a parallel port it may not be evident that you have a motion controller but you do. The parallel port driver takes numerical information from Machs motion
planner and uses the PCs CPU to produce high speed high accuracy pulse streams to the motor drivers. All in all the parallel port driver is a very clever bit of work.
So when Mach is running there are two bits, Machs GUI /motion planner and the Parallel Port Motion Controller.

The motion controller offers high speed signal control for a number of common CNC processes, THC and Lathe threading are two, but probing, homing and axis squaring
are among others. You can't program most motion controllers so you can only do what the maker of the controller built in. You may have seen Galil, Vital Systems and
PoKeys offer motion controller level programming, usually at extra cost. This low level high speed program code could be very useful for a project which requires
high speed signal processing that is not a standard motion controller feature. You will need to be a competent programmer to make sense of it.

The de-bounce is a number supplied to the motion controller from Mach to set the number of 'time slices (40us at 25kHz)' that a signal is to be monitored before the
signal in 'known to be good'. It is a kind of filtering arrangement designed to stop very rapid transient voltage signals from falsely be interpreted as a valid signal.
The length of the time slices gets shorter as the kernel frequency goes up. Lets say you had a problem signal and had it 'heavily' debounced for 10 time slices at
25khz, ie 400us. If you then upped the kernel speed to 45kHz (22us) you need to increase the number of times slices to maintain 400us filtering 400/22=18 (about).

The simple summary is that Machs input are good for slowly varying signals, a few Hz whereas the motion controller can handle signals well into the kHz range. Debounce
is a simple filtering technique and is convenient to do programmatically as opposed to fiddling with little capacitors.

Craig
My wife left with my best friend...
     and I miss him!
Thanks for the response Craig, I think I understand it, sort of!

I use the parallel port to drive all signals on my system, so as I now understand yours and Hoods comments, THC Up, Down and Arc OK, spindle and probe are sampled at 40uS or is it every input via the parallel port is sampled at 40uS including limit and home.

Yes I understand the debounce section but I am having difficulty in understanding what was debounced and what was not, I could not determine from docs.

I guess it is the  sentence you have written 'Mach3 inputs are polled at about 10Hz known as the macro pump rate'  I just think of  the THC as inputs like any other.

Thanks, I will read again when I have woken up properly.

Adrian
Hi,
I think that all input signals to the motion controller are monitored, I wouldn't say sampled exactly, but are monitored by high speed circuitry. Those signal are only
very slowly reported back to Mach. Some signals like THC are handled within the controller and what gets reported back to Mach is a bit irrelevant.

THC UP and THC DOWN are not handled like ordinary signals.

Imagine you have Mach plan a move in the X and Z axes. The move is 100mm in X but because of a slight tilt on your plate the Z axis needs to lower by 1mm over the
100mm cut. Between Machs planner and your parallel port controller the controller produces 100,000 pulses to the X axis and 1000 pulses to the Z axis, I have
assumed 1000 pulse per mm to make it easy, and the move is planned to take 5 seconds. For simplicities sake we'll ignore the accel-deccel stages of the move.
The pulse rate is 100,000/5= 20kHz for the X axis and 1000/5=200Hz for the Z axis.

Once the move has been planned and dispatched to the controller it can't be changed. However WE DO NEED TO CHANGE IT ON THE FLY to accommodate THC variation.
Lets say that the THC variation is 0.5mm in addition to the 1mm the Z axis is lowering and again to make it less confusing say that it happens evenly over 100mm.
Given that Mach and the PC have planned and dispatched the move the motion controller is now the only device that can change the Z motors path. The motion controller
will insert one extra pulse every two normal pulses. So over the entire move the Z axis has lowered 1000 pulses due to the plate angle and 500 pulses due to THC.

That was a highly idealized example to show how it works. Imagine now that the THC variation is +0.5mm over the first 50mm and then -0.5mm over the last 50mm.
The controller will insert one pulse for every one normal pulse, change the direction signal at the 50mm point and insert one pulse for every normal pulse but in the
other direction. As you can see this starts to get complicated quite quickly and is happening very rapidly. There is no way you could transmit the data back to Mach and have
the main CPU do the calculation, by the time it even got the data it would be too late.

THC is a specialized function of the motion controller, it really has little to do with Mach at all.

Craig
My wife left with my best friend...
     and I miss him!
Thanks again Craig, the information is very useful.

On my own hobby build system I made certain assumptions down to the speed of pins so I  can change a few things and probably improve a bit on THC speed.

I have not seen this information in any docs, but will continue to look for it.  Will have to re-read all again including the stuff i do not use.

Thanks again.


Adrian
Hi Adrian,

Quote
I have not seen this information in any docs, but will continue to look for it.  Will have to re-read all again including the stuff i do not use.

Given that THC is a function of the motion controller I would not expect to find any documentation about how it works internally.

All of the functions which are enacted by the motion controller like probing, lathe threading, homing and so on have been developed by each
manufacturer. While I little doubt there are many similarities between the methods and approach taken by each manufacturer they will all be unique.
Further as the THC example I pointed out above shows that a seemingly simple function is very often not simple to program at all. The investment in time
to devise and test these functions is very substantial. The individual manufacturers will not be releasing any details that give a leg up to any potential
competitor.

Craig
My wife left with my best friend...
     and I miss him!
OK sorry, I had assumed as I am using the Mach parallel port driver there may have been details about.

Cheers

Adrian
Hi Adrian,
yes you would have thought that the parallel port driver being Artsoft intellectual property that they may have been more forthcoming about the internal
details of features like THC. To my knowledge there is no such documentation.

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