Hello Guest it is March 19, 2024, 01:08:04 AM

Author Topic: Where did I go wrong?  (Read 3090 times)

0 Members and 1 Guest are viewing this topic.

Offline Fastest1

*
  •  920 920
  • Houston, TX
    • View Profile
Where did I go wrong?
« on: October 21, 2009, 11:43:32 PM »
M3
G0 Z1
G0 X0 Y0
M98 P0001 L86
G1 X0 Y-1.4480 F5
G1 Z0 F5
G1 X7.4155 F5
G1 Y-4.537 F5
M30
O0001
G0 Z#100 F5
#100=[#100+.005]
G1 Z#100 F5
G1 X0 Y-1.453 F5
G1 X7.4405 F5
G1 Y-4.537 F5
M99
M30
%

I ran this code (something I have been screwing up). It did everything according to the plan until the 42nd time around and the z didnt lift when it was returning to its start point. I think it was going to start a finish pass sequence but I am not sure. I then wrote another program that worked well except I thought it was only cycling 41 times but apparently I am looking at the wrong thing?

%
M3
G0 Z1
G0 X9 Y-3.05
M98 P0001 L41     ( I thought this L41 meant 41 loops does it not?)
G1 X9 y-3 F16
G1 X7.625 F16
G1 Y-1.10 F16
G1 X0 F16
M30
o00001
G0 Z1
G0 X9 Y-3.05
G0 Z#100 F16
#100=[#100-.01]
G1 Z#100 F16
G1 X7.625
G1 Y-1.10
G1 X0
M99
M30
%

Any tips would be greatly appreciated. I am getting closer!
I want to die in my sleep like my grandfather, not like the passengers in the car! :-)

Offline alenz

*
  •  137 137
    • View Profile
Re: Where did I go wrong?
« Reply #1 on: October 22, 2009, 01:15:09 AM »
I see a couple of things.
One you need to specify an initial value for the variable #100 before calling the sub for example:
 #100 = 0.000
Or else it MAY default to zero or it MAY use a random value leftover from a previous run.

Another is in your second example, the first line of the sub (G0 Z1) will lift the Z  btween loops but it will go crosscountry at the current Z#100 depth after the last loop. You need to put another 'G0 Z1' either at the end of the sub (just before line M99) or in the next line after the M98 calling block.
al
« Last Edit: October 22, 2009, 01:24:39 AM by alenz »

Offline Fastest1

*
  •  920 920
  • Houston, TX
    • View Profile
Re: Where did I go wrong?
« Reply #2 on: October 22, 2009, 11:11:33 AM »
Alenz
thanks for the help. I don't have a clue what I am doing. I am reading the Cnc programming handbook and trying to get a grasp. About the only thing I thought I understood was the bracketed area #100=[#100-.050] would imply 20 cuts per inch. If I try a gcode commenter certain terms are still vague at best. Could you edit my code (the lower one) to show the specific variable I should have inserted and where? Also I have just been inserting coordinates where I thought they should be. Lots of watching the dro's without the controller being powered up. If I wanted to radius the outside corner of any square corner (G1?) using G2 if path was clockwise using a cutter .2480 wide, what would I say?  
« Last Edit: October 22, 2009, 06:35:09 PM by Fastest1 »
I want to die in my sleep like my grandfather, not like the passengers in the car! :-)

Offline alenz

*
  •  137 137
    • View Profile
Re: Where did I go wrong?
« Reply #3 on: October 24, 2009, 02:41:09 AM »
Sorry for the slow response.
Suggest you review/study Ray L’s original example that you are using as a guide. It is very well documented so I will only try to elaborate on your changes.
Just put the #100 = 0.000 at the very beginning. Remember #100 is the name of a variable which contains a number and it can be used in your code the same as a number. But as a variable, that number can be changed. For example #100 = [#100 – 0.010] means ‘Let the new value of #100 be equal to it’s current value minus 0.010’. Thus you can see why it must have a current (starting) value and must be initialized before it can have a valid meaning and be used as a number.
You are correct to add a G0 Z1 in the sub to raise the tool to the safe height because you are returning to the start position directly (not retracing the cut path). The only problem is that the G0 Z1 is at the front of the loop so at the end of the last loop the depth is still at the final cut depth, (G1 Z#100 F16). The flow then returns to the line following the M98 P0001 L41 line which called the sub. This line (G1 X9 Y-3 F16) moves the tool directly back to the starting position at full depth which is what you were trying to avoid. So either move or add the G0 Z1 to the end of the loop (just before the M99) or insert it between the M98 line and the G1 X9 Y-3 F16 line.  Or better yet, put it in all three places, doesn’t hurt anything and is probably the safest.
Hope this helps
Al
« Last Edit: October 24, 2009, 02:45:24 AM by alenz »