Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: joeaverage on August 19, 2016, 03:03:17 AM

Title: confusion over DRO numbering
Post by: joeaverage on August 19, 2016, 03:03:17 AM
Hi All,
I have just started to write my own macros for a coil winding project.
I have some code written and it appears to work although have yet to try
it out on the machine.

My confusion over DRO/LED/Button numbering means that it has been a slow
process.

I have an encoder mounted on the winding spindle and have enabled 'encoder1'
on the ports and pins page. I have successfully read the encoder at DRO 17203.
This much at least I have tested on the machine.

I have found no definitive documentation which tells me what DRO's monitor encoders
1 thru 4 on the ports and pins page.
 
Additionally while I can read 17203 (by my understanding a 'new' number) I cannot load
the existing A axis DRO with the result except by using setOEMDRO(803), an 'old' number?

Is there a logical explanation for the seeming numerous numbering systems?

Craig
Title: Re: confusion over DRO numbering
Post by: ger21 on August 19, 2016, 08:45:43 AM
I don't really understand what your problem is? Or what you're trying to do?
The A axis DRO is OEMDRO 803, so that's how you write to it (SetOEMDRO(803))

There is only one numbering system.
You have pre-defined OEM numbers, and user definable numbers.



Title: Re: confusion over DRO numbering
Post by: joeaverage on August 19, 2016, 10:16:12 AM
Hi,
I wish to read the spindle encoder and display it, that  I can achieve. The spindle motor is a current
limited DC motor acting as a torque motor where its speed will be regulated by me impeding the
wire. I want Mach3 to count the turns and shift the Xaxis to lay them down, up to 20 layers deep.

My hope is that provided I keep the spindle speed low enuf, say 1 rev/sec, that the Xaxis will maintain
step.

As it turns out I have written the code and tested it on my laptop but have yet to try it on the machine,
that is tomorrows adventure.

My confusion is more about the DRO numbering setup. I found that I could read the encoder at DRO(17203)
and yet to display it  using Machs existing DRO at 803. The XLS file in the general forum indicates 'old' and
'new' numbers. Can I use either?

I am also confused about the distinction between predefined and user definable numbers, how do I distinguish
the two?

Apologies if these questions seem absolutely basic. I have recently coded in C a field oriented servo controller
so I can program but with VB I'm back in the deep end until the confusion clears!

Craig
Title: Re: confusion over DRO numbering
Post by: ger21 on August 19, 2016, 10:28:20 AM
Old, or Standard DRO's, have been replaced by new, or OEMDRO's. Yes, you can use either  or both, but I'd recommend using OEMDRO's for consistency and less confusion.

http://www.machsupport.com/Mach3Wiki/index.php?title=OEM_DROs

User DRO's are created by the user. The Wiki says they should be from 1000 up, but I think there was a change at some point, and I would start over 1200. Not sure if there are unlimited numbers available or not. Most people use numbers in the 1200-2000 range.


Where did the #17203 come from? And how are you reading the encoder?

Title: Re: confusion over DRO numbering
Post by: joeaverage on August 19, 2016, 11:31:35 AM
Hi ger21,
thanks for your reply, the wiki is excellent, clear and concise.

I found 17203 in OEM List Alpha 6.1 XLS near the top of the General Forum page.
Its new description is 'Encoder position A'. I read it using getOEMDRO(17203).
It was to my knowledge at that time the only DRO which was monitoring Encoder1
which I had enabled.

Looks like I have some more experimenting to do!

Craig
Title: Re: confusion over DRO numbering
Post by: ger21 on August 19, 2016, 12:29:42 PM
OK, if you go buy that list, Old/New have very different meanings.
In that list, "New" was meant  to be preliminary work for Mach4.
I'm actually surprised that any of those high numbers even work.

I'd recommend using the Wiki first, and elsewhere if you can't find something in the Wiki.
Title: Re: confusion over DRO numbering
Post by: joeaverage on August 19, 2016, 06:51:42 PM
Hi ger21,
it starts to make sense and given that I'm surprised it works as well.
Will experiment a bit more today and report back.

Craig
Title: Re: confusion over DRO numbering
Post by: joeaverage on August 19, 2016, 08:11:28 PM
Hi All,
just as a matter of interest the coils I'm winding are for a LVDT that I'm making for use as a toolsetter/probe.

I use 0.2mm drills and 0.4mm endmills on circuit boards and they are VERY tender. Any force used to probe or
touch off breaks them. What I want is a device that I can place on top of the object, a blank circuit board typically,
to be milled and touch off to it with a force of 10grams or less. I use cuts as light as 50um on circuit boards and
need a repeatable accuracy of 5um or better.

I've made a handwound LVDT with a ferrite armature and a homebrew exicter oscillator/demodulator. I measured
its sensitivity yesterday at 84mV/mm with 2.5Vrms excitation for a specific sensitivity of 33mV/mm/V. This is still
at the low end of the published sensitivities by various commercial makers.

The new coil arrangement I have designed should up the sensitivity to 80mV/mm/V. The noise floor is about 0.3mV
so I'm hoping to achieve a repeatable accuracy of 1um with a linear range of 5mm.

My current design uses a passive demodulator with an estimated voltage loss of 14dB or a factor of 2.25. If I use
an active demodulator with 0dB loss and can hold the noise floor down the sensitivity could be a high as 179mV/mm/V
which is very respectable.

The best part is that so far its cost me about $50US for parts/materials that I couldn't make or recycle and those parts
are enuf to make 8 of them.

Craig
Title: Re: confusion over DRO numbering
Post by: joeaverage on August 20, 2016, 05:40:47 AM
Hi All,
have been experimenting on the machine and have made progress but questions remain..

Following ger21's advice I'm using DRO's 143 and 173.

DRO 143 gives the actual pulse count whereas DRO 173 gives the value in units. I using
a recycled rotary encoder which has 24ppr for 96 counts per revolution. With Encoder4 enabled
in Ports & Pins I can see the pin state LED's operate on the Diagnostics page.
I can read both 143 and 173 and display them in DRO's 802 and 803. So far so good.

What I can't do is set either 143 or 173 to zero.

Have tried many variations of setOEMDRO(143.0) without success.
Am I correct in assuming that it is not possible to set or reset an encoder DRO?

Craig
Title: Re: confusion over DRO numbering
Post by: ger21 on August 20, 2016, 06:51:41 AM
Can you use the X, Y, or Z encoder DRO's? 140-142?
I think that there are buttons to zero those 3, but apparently not for the one you're using.

The following may or may not be accurate:

DoOEMButton (133) will zero DRO 140 and 170.
DoOEMButton (134 will zero DRO 141 and 171.
DoOEMButton (135) will zero DRO 142 and 172.
Title: Re: confusion over DRO numbering
Post by: joeaverage on August 20, 2016, 08:03:49 AM
Hi ger21,
will try them out tomorrow.

I imagined that encodersX-Z would affect the multifunction displays and so decided against
using them. For my purpose provided multifunction X actually reflects X position and at least
one other reflects the number of turns wound that would be fine.

I encountered another issue which baffled me. I was stepping thru my macro and found that
the turns counter would increment despite not having rotated at all, I'm turning it by hand
while testing. In the Ports/Pins page I nominated count/unit as 96 but left velocity at its default
of 100. It has occurred to me that it may be causing my counter to increment unexpectedly.
Again will have to wait until tomorrow to test.

I'm grateful that you have taken the time to reply, your assistance has helped me along the path
considerably.

Craig
Title: Re: confusion over DRO numbering
Post by: joeaverage on August 21, 2016, 02:30:33 AM
Hi All,
had some pretty good success. Have managed to write and run a simple
coilwinding script.

Still haven't had any luck trying to set or reset DROs 140 thru 146 or 170 thru 176
using setOEMDRO(n,0.0). Beginning to think that they can't be written to directly
a bit like some of the coord positions on the diagnostics page, you can highlight them
write in the cell and Enter but the coord reverts to whatever it was. To change a coord
you need to change the underlying data which are used to calculate the coord concerned.

The simple expedient is to preread the DRO and store its initial value and subtract within the
body of the script.

The second issue where DRO(173) would increment at each read despite DRO(143) from which it
is calculated not changing still perplexes me. Despite setting the velocity component in Ports/Pins to zero it
still behaves as if it has a velocity component.

The way around it was just to read DRO(143), the raw encoder count, and divide by the counts/unit
value.

The last thing I encountered was that I was using a while loop until the turns counter reached 500
and if for any reason I could not achieve the magic 500, broken wire, the house catches on fire or
whatever I could of course Estop but could not prevent the script from running at reset. In the event
I crashed Mach several times and had to reboot the controller, not ideal! I had to add an 'abort' function
in the loop.

I have a running script, 'yehay', it might not be elegant, efficient or robust but it works. I can get on with
the project and have learnt some new stuff on the way.

This hobby is one very big learning experience.... and it doesn't seem to stop! I am delighted to have learnt
at least a little VB, the flexibility and power that it brings to Mach can't be understated.

This leads me to my next question. I have written a script that takes a Gcode text file and processes a correction.
The script works very well as is and surprisingly fast at processing files of 500k.
I have used a textbox to input the path and filename but it is pretty tiresome and mistake prone. Is there a
'browse' function/object in VB that I might use?

Craig