There was something very familiar about this config, I realised it is adapted from a lathe config I have, using a velocity stepgen, complete with the same comments :-)
I must have passed it on at some point.

On 22/04/17 19:47, Sag ich Dir nich wrote:
Hello,

i got the Step/Dir Spindle working with ramping and everything except if i command M4 the Dir pin changes immediately. It should change when the current rpm is 0.

What do you base the assertion that it should only change when RPM is 0 upon?

This old thread discusses the issue and I don't think anything has changed
https://en.industryarena.com/forum/reverse-lathe-turn-m3-m4--67203.html

You don't have any connections in your config that will ensure this, no spindle brake, no monitor of spindle speed.
The dir pin is a simple bit pin, set to forward or reverse.

An easy way to do this is just program
M3 S100
...
M5
G4 P5 ;delay to ensure spindle stops
M4 S100

Alternately, if you have a spindle brake it needs tying to M5, using detection of 0 RPM spindle etc.

The only reason you would reverse spindle direction on a lathe normally, is switching from a conventional cutting tool, to a threading tool or parting tool which
is held inverted to aid chip removal or something similar.
There is plenty of time to stop the spindle and restart it, before or after the tool change.

regards

Here is my spindle config:

# ################
# B [4] SPINDEL
# ################

#   Use a scale module for offset and scaling of the stepgen
#   Offset and scale are determined by first calculating and testing
#
loadrt scale count=1
addf scale.0 servo-thread
setp scale.0.in 0
setp scale.0.gain 1.00  # GIVES TRUE 600 RPM in M4
setp scale.0.offset 0
#
#   Initialise the stepgen for the spindle
#
setp hpg.stepgen.04.position-scale    1
setp hpg.stepgen.04.maxvel              8000
setp hpg.stepgen.04.steplen             1000
setp hpg.stepgen.04.stepspace         1000
setp hpg.stepgen.04.dirhold               200
setp hpg.stepgen.04.dirsetup             200
setp hpg.stepgen.04.maxaccel          2000
setp hpg.stepgen.04.steppin              924
setp hpg.stepgen.04.dirpin                926
setp hpg.stepgen.04.control-type       1

#   Enable it
net machineison halui.machine.is-on => hpg.stepgen.04.enable

#   Connect spindle speed to scaler
net spindle-cmd motion.spindle-speed-out => scale.0.in

#   Connect scaler output to stepgen velocity
net spindle-freq <= scale.0.out => hpg.stepgen.04.velocity-cmd 

#   Connect output to the pin for the analog voltage of spindle2 board
net spindle-out <= hpg.stepgen.04.steppin => #924 #bb_gpio.p9.out-24 

# Some problems setting up logic to match the reversing contactor
#   This works, connecting CCW to stepgen DIR to Spindle2 DIR
net spindle-rev motion.spindle-reverse => bb_gpio.p9.out-26


i tried commenting out "net spindle-rev motion.spindle-reverse => bb_gpio.p9.out-26" but then it does not change the direction

basically what i need is the direction pin to change, when i command the opposite direction, at 0 rpm, after the spindle has ramped down for example

M3 S100
M4 S100 (spindle ramps down to 0 rpm then the Dir pin changes state and the spindle ramps up again)

i appreciate any help


--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to