Page 3 of 3
Re: Can't change homing direction! (Resolved)
Posted: Mon May 25, 2020 9:58 am
by martyscncgarage
I only wished we would have started a thread for 4th axis information. I did change subject lines to include the terms 4th Axis so it searchable and I made a new post pointing to this page.
Timely for me as well, as I will be setting up a Centroid RI-5C on my Atrump.
I do have a question, I also have a HAAS RT160. The RI-5C has a Redcom DC Brush Servo motor. As it happens, I have a spare RedCom motor. I can install it in the HAAS RT160. But wonder what is typically done when a user has two Rotary tables?
Marty
Re: Can't change homing direction! & 4th Axis Info (Resolved)
Posted: Mon May 25, 2020 12:15 pm
by swissi
cncsnw wrote: ↑Sat May 23, 2020 7:59 pm
I don't think it makes the least bit of difference whether you use "IF #50001" or "IF #50010".
I would agree with you that is should not make a difference so it makes it even more important for Centroid to explain why they saw the need to change their standard from #50001 to #50010.
-swissi
Re: Can't change homing direction! & 4th Axis Info (Resolved)
Posted: Mon May 25, 2020 12:47 pm
by swissi
cncsnw wrote: ↑Sat May 23, 2020 7:57 pm
swissi wrote:do you have any code samples that actually prove that the command "If #50001" does indeed stop the look ahead. I'm getting increasingly suspicious that this command doesn't do anything, at least not on the Acorn board.
Enter the following program:
Code: Select all
N10 #150 = 1.234
N20 G10 P701 R2.345
N30 G0 X0
N40 G1 F2 X2
N50 IF [#50001]
N60 #150 = 3.1416
N70 G10 P701 R2.7183
Start it running, but during the N40 move, press Cycle Cancel (ESC).
Look in the file "c:\cncm\job.xml", or use M225 or something similar, to inspect the value of #150. Look in the Parameters table to see what value is in Parameter 701. What values do you find there?
Now delete the "IF [#50001]" line; run the program again; and again cancel it while it is still doing the N40 move.
What values do you find in #150 and P701 this time?
Thanks Marc for the code sample. I think the confusing part and important to understand is the fact that there are different types of "look aheads" that can mess with your program and give you unexpected results. It's very important to know that the "If #50001] sync variable (look ahead stopper) doesn't block the graphing going past your sync statement and messing with your parameters. So when you load your code example, Graph it and check #150 you see that it has the last value set in the code (3.1416). In your example, the variables go back to the intended values when you actually run the code and the command "If #50001" does indeed stop the look ahead but there could be code samples that would not recover that nicely from the mess up that the Graphing did.
I think the lesson here is that when you have code that can be messed up by a look ahead, you should also use the command "If #4201 || #4202 Then GOTO xxxx" to prevent the Graphing from messing with your variables.
I found another form of "look ahead" that seems to be used by the new "Active Codes" status line in CNC12. When you load and run this code sample below, you will notice that the Active code line will display that the machine is in G21 mode while the move is clearly done in G20. When you comment out the last G21 command in the program, the display is correct. That confirms that the logic being used by the "Active Code" status line is using some kind of look ahead and just displays the last G20/G21 command it finds in the program. Neither a If #50001 nor a If #4201 solves this issue:
Code: Select all
If #4201 || #4202 Then GOTO 1000 ;Skip macro if graphing or searching
G20
IF [#4006 == #25001] THEN GOTO 900 ; #4006 active units of measure, #25001 default machine units of measure
N600 ; Default is Inch but set to Metric
M200 "Warning!!!\n\nCurrently set Units don't match System Units!\n\nPress Cycle Start to Continue"
G20 ; set machine to default units
GOTO 900
N700 ; Default is Metric but set to Inch
IF [#4006 != #25001] && [#25001 == 20] THEN GOTO 700
M200 "Warning!!!\n\nCurrently set Units don't match System Units!\nAll Parameters MUST be in mm!\nMachine will be set to Metric for Probing Cycle!\n\nPress Cycle Start to Continue\nPress Cycle Cancel to Abort"
If #50001
G21 ; set machine to default units
N900
M200 "Current Unit settings = %f" #4006
G91 G1 X1 F1
N1000
-swissi