# Lathe stops at code line

*Lathe stops at code line*was created by

*Erikcnc*

so i wanted to test my rebuildet cnc lathe, but got this thing i cant find.

i have made a little program in fusion. i set up the lathe for a dry run, but it stops at line 18.

i got a post processor from autodesk.

```
%
(1001)
N10 G7
N11 G18
N12 G90
N13 G21
(FACE2)
N14 T1 M6
(TEST TOOL)
N15 G54
N16 M8
N17 G97 S84 M3
N18 G95
N19 G90 G0 X38. Z1.
N20 G96 D3500 S10 M3
N21 G0 Z1.564
N22 X18.
N23 G1 X10.828 F0.127
N24 X8. Z0.15
N25 X-0.2
N26 X2.628 Z1.564
N27 G0 X18.
N28 Z1.164
N29 G1 X10.828 F0.127
N30 X8. Z-0.25
N31 X-0.2
N32 X2.628 Z1.164
N33 G0 X38.
N34 Z1.
N35 G97 S84 M3
(PROFILE1)
N36 M9
N37 M5
N38 M1
N39 M8
N40 G97 S114 M3
N41 G95
N42 G0 X28. Z1.
N43 G96 D3500 S10 M3
N44 G0 Z1.414
N45 X10.68
N46 G1 X9.828 F0.127
N47 X7. Z0.
N48 Z-4.35
N49 X8.
N50 X12.
N51 G0 Z1.414
N52 X8.828
N53 G1 X6. Z0. F0.127
N54 Z-4.35
N55 X7.
N56 X9.828 Z-2.936
N57 G0 Z1.414
N58 X7.828
N59 G1 X5. Z0. F0.127
N60 Z-1.493
N61 G3 X5.3 Z-1.85 I-0.35 K-0.357
N62 G1 Z-4.35
N63 X6.
N64 X8.828 Z-2.936
N65 G0 Z1.414
N66 X7.085
N67 G1 X4.257 Z0. F0.127
N68 Z-1.35
N69 X4.3
N70 G3 X5.3 Z-1.85 K-0.5
N71 G1 X8.128 Z-0.436
N72 G0 Z1.414
N73 X6.343
N74 G1 X3.514 Z0. F0.127
N75 G3 X3.8 Z-0.35 I-0.357 K-0.35
N76 G1 Z-1.35
N77 X4.3
N78 X4.458 Z-1.356
N79 X4.611 Z-1.375
N80 X4.757 Z-1.405
N81 X7.585 Z0.009
N82 G0 Z1.164
N83 X5.707
N84 G1 X2.628 F0.127
N85 X-0.2 Z-0.25
N86 X2.8
N87 X2.877 Z-0.258
N88 X2.941 Z-0.279
N89 X2.985 Z-0.312
N90 X3. Z-0.35
N91 Z-1.75
N92 X4.3
N93 X4.377 Z-1.758
N94 X4.441 Z-1.779
N95 X4.485 Z-1.812
N96 X4.5 Z-1.85
N97 Z-4.35
N98 X7.328 Z-2.936
N99 X8.5
N100 G0 X28.
N101 Z1.
N102 G97 S114 M3
N103 M9
N104 M5
N105 M30
%
```

Please Log in or Create an account to join the conversation.

*PCW*on topic

*Lathe stops at code line*

It is an error if:

A new feed rate is not specified after switching to G94 or G95

Another possibility is motion.spindle-speed-in not connected properly or backwards etc

Please Log in or Create an account to join the conversation.

*Grotius*on topic

*Lathe stops at code line*

For accurate handling, if i count the lines to 18 in the file i end up with :

N22 X18.

I mention that the fusion postprocessor can be updated to remove some dot's.

linuxcnc.org/docs/2.6/html/gcode/gcode.h...sec:G93-G94-G95-Mode

G95 - is Units per Revolution Mode In units per revolution mode, an F word is interpreted to mean the controlled point should move a certain number of inches per revolution of the spindle, depending on what length units are being used and which axis or axes are moving. G95 is not suitable for threading, for threading use G33 or G76. G95 requires that motion.spindle-speed-in to be connected.

It is an error if:

1. Inverse time feed mode is active and a line with G1, G2, or G3 (explicitly or implicitly) does not have an F word.

2. A new feed rate is not specified after switching to G94 or G95

Pcw wrote about the feed rate (2), it can be also option (1), but G93 is not the problem in this case.

I think it has to to with this : the controlled point should move a certain number of inches per revolution of the spindle.

With reducing X18 to X0.005 the machine will problably pass this line.

Please Log in or Create an account to join the conversation.

*andypugh*on topic

*Lathe stops at code line*

Which line is highlighted when the motion stops?

Note that if spindle-at-speed is active then G0 moves will happen, but the machine will pause and wait for the spindle-at-speed pin to go true before any G1 move after a spindle speed change.

Please Log in or Create an account to join the conversation.

*Erikcnc*on topic

*Lathe stops at code line*

andypugh wrote: I suspect that this is a spindle-at-speed problem.

Which line is highlighted when the motion stops?

Note that if spindle-at-speed is active then G0 moves will happen, but the machine will pause and wait for the spindle-at-speed pin to go true before any G1 move after a spindle speed change.

Thanks all for your answers.

I mend in deed line N22.

I've tried to remove the point and even edit it eith extra decimal.

I think it is indeed that speed problem.

The lathe has a spindle servo motor with encoder. 1:1 ratio.

The encoder output from the driver is connected to the mesa 7i76e board. What do I need to change?

Please Log in or Create an account to join the conversation.

*andypugh*on topic

*Lathe stops at code line*

(And is this LinuxCNC 2.7 or 2.8? As I changed all the spindle pin names in 2.8)

Please Log in or Create an account to join the conversation.

*Erikcnc*on topic

*Lathe stops at code line*

andypugh wrote: Do you see any mention of "motion.spindle.at-speed in your HAL file?

(And is this LinuxCNC 2.7 or 2.8? As I changed all the spindle pin names in 2.8)

yes, i fount the line "motion.spindle.at-speed " in the HAL file.

also i don`t know if i have the scale right.

linuxcnc is version 2.7.14

##### Attachments:

Please Log in or Create an account to join the conversation.

*andypugh*on topic

*Lathe stops at code line*

I suspect you might find that your spindle-velocity-fb has a different sign to the spindle-velocity-cmd. If it is that make your encoder scale negative. That's [SPINDLE_9]ENCODER_SCALE in your INI.

Please Log in or Create an account to join the conversation.

*Erikcnc*on topic

*Lathe stops at code line*

andypugh wrote: I suggest opening three halmeters and looking at near.0.in0, near.0.in1 and near.0.out

I suspect you might find that your spindle-velocity-fb has a different sign to the spindle-velocity-cmd. If it is that make your encoder scale negative. That's [SPINDLE_9]ENCODER_SCALE in your INI.

okay. so at 1500 rpm near.0.in1 gives a value of 25.

that should be fine. (1500/60)

but spindlevel-fb-rps gives a mutch lower value. and not constantly. it pops up ones a while. just enough to make a picture.

encoder scale is: 1024

##### Attachments:

Please Log in or Create an account to join the conversation.

*andypugh*on topic

*Lathe stops at code line*

hm2_7i76E.encoder.00.count is solidly on zero. This leads me to suspect that one of the spindle encoder phases is not connected.

(If this is deliberate then you need to set counter-mode to true for that encoder)

Please Log in or Create an account to join the conversation.