Hi Will!
You are right, #516 is not used directly in probe.nc.
I’m ab it confused at the moment

.
I found your translated probe.nc in this forum (
https://madmodder.net/index.php/topic,12427.msg148354.html#msg148354 ) and I think also in this forum there was a post with the nc files of the RATTM RMHV2.1 version with the translated comments (sorry, I do not find the post at the moment, I downloaded the files the time I read the post some weeks ago). I did not check it that time and thought, that the files on my device (I bought a RATTM RMHV2.1) are identical – but they are not! The ones on my device are not translated!?
“Your” probe.nc is different to this two versions at all. It does a three times test and an averaging, “my” does only a one time test…
I will put the translated probe.nc I downloaded at the end of this post so you can compare. The question is: where did you get your version?! (BTW: a rough look showed no differences in your slib.nc to mine) .
But to come back to “the real thing”: In Probe.nc the first ()-comment (in all versions) is
(Reads the current machine tool coordinate position ¶ÁÈ¡µ±Ç°µ¶¾ß»úÐµ×ø±êλÖÃ)
followed by
#20=#864
#21=#865
#22=#866
so I assumed that #864.. are the current machine tool coordinate positions ;-)
In the system lib I found #864 (to be precise: #866) also used in subprogram O100 for the “case statement” of #516. If #516 is 7, #864 is used for correction (with this #[#1+2] indirect addressing trick). #516 may range from 0 to 7 (not 0..6)! This is why I said that #516 is different to #455.
Some words about M101 and M102 used in probe.nc:
In Probe.nc the following is used
M101
G91 G01Z-100 F100
M102
G04 P0
I’m now more or less sure that M101 means “enable stop movement if probe enabled and probe contact closed” and M102 means “disable stop movement on probe contact”.
So, if M101 is “active”, the probe contact acts like the normal limit contacts! I did not try this, but I think, this also works on any movement in any direction, not only on Z. The G04 P0 is “for synchronization”, whatever that means.
This in mind it should not be a problem to write a macro which finds the middle of inner/outer circles, rectangles… (assuming, the probe can touch in X/Y directions)

. The result (the center) may be stored as a local zero-position of G55 or any other local coordinate system for readout or other usage…
You asked, whether my probe function works and what are the differences between mode 1 and 2 ?! To be honest: I don’t know. I tried it and I have an idea, but I do not use it at the moment (need some practice with my machine until I risk a tool lost ;-) ) . Here my idea: Mode 1 uses the probe and sets Z to 0 in the local coordinate system (with some offsets) after probe contact. Mode 2 uses an internal variable to store the first probe result done after an All-Zero-Setting of coordinates by the user. This internal variable is used from the second probe on to use differences to the first to calculate relative tool offsets (see also comments in Probe.nc. Since the probe mode number in Probe.nc is not used (at least I don’t can figure it out), there must be some other “magic” build in the system)).
Josef
P.S.: Here “my” (unmodified) Probe.nc (translated version):
G04P0 ;Pause for 0s£¬The current machine coordinate position is correctly read for subsequent programs ΪºóÐø³ÌÐòÕýÈ·¶ÁÈ¡µ±Ç°»úÐµ×ø±êλÖÃ
M5;Close the spindle ¹Ø±ÕÖ÷Öá
(Reads the current machine tool coordinate position ¶ÁÈ¡µ±Ç°µ¶¾ß»úÐµ×ø±êλÖÃ)
#20=#864
#21=#865
#22=#866
;Determines whether the system uses the fixed position tool presetting mode or the current position setting mode
(¹Ì¶¨¶Ôµ¶Ä£Ê½Ï£¬Çó³öX¡¢Y¡¢ZµÄ½ø¸øÁ¿)
IF#571EQ0GOTO1
#1=#572-#20
#2=#573-#21
#3=#574-#22
GOTO2
(X, Y, Z feedrate is cleared in current tool setting mode µ±Ç°¶Ôµ¶Ä£Ê½Ï£¬X¡¢Y¡¢Z½ø¸øÁ¿ÇåÁã)
N1#1=0
#2=0
#3=0
(Move to the initial position of the tool ÒÆ¶¯µ½¶Ôµ¶³õʼλÖÃ)
N2G91G00Z#3
G91G00X#1Y#2
(100% speed detection of 100mm knife detection signal ÒÔ100ËÙ¶ÈÏÂ̽100mm¼ì²â¶Ôµ¶ÐźÅ)
N1M101
G91G01Z-100F100
M102
G04P0 ;Pause for 0s ÔÝÍ£0s
#402=#400;Save the coordinate system Z axis zero offset ±£´æ×ø±êϵZÖáÁãµãÆ«ÖÃ
#403=1;Set the automatic correction coordinate system flag ÉèÖÃ×Ô¶¯ÐÞÕý×ø±êϵ±êÖ¾
#404=-#870;Save the thickness of the block, if the thickness of the blade before the parameter is 0, the system will use the variable correction on the block thickness parameters in order to complete the first knife ±£´æ¶Ôµ¶¿éºñ¶È£¬Èç¹û֮ǰ¶Ôµ¶¿éºñ¶È²ÎÊýΪ0£¬ÏµÍ³½«²ÉÓøñäÁ¿ÐÞÕý¶Ôµ¶¿éºñ¶È²ÎÊý£¬ÒÔÍê³ÉµÚÒ»´Î¶Ôµ¶
G91G01Z#575F#578;The tool is completed and the Z axis retracts ¶Ôµ¶Íê³É£¬ZÖá»ØÍË