adding the spindle encoder questions (PPMC)

More
25 Dec 2016 22:25 #84691 by Jake
Merry Christmas to everyone

I need to add the spindle encoder to my machine. I have Pico hardware, Jon gave me some additional code to enter in my config files. But now I and getting

ppmc.0.encoder.04.index-enable not found

I think I need to add the information for the spindle encoder in my IO and motion.hal files

All the other axis are x,y,z....

would the spindle be S axis like....or is the spindle letter designation something else? or what ever I want as long as its consistent ?

net Sindex <= axis.4.index-enable ppmc.0.encoder.04.index-enable
et Xindex <= axis.0.index-enable ppmc.0.encoder.00.index-enable
net Yindex <= axis.1.index-enable ppmc.0.encoder.01.index-enable
net Zindex <= axis.2.index-enable ppmc.0.encoder.02.index-enable
net Sindex <= axis.4.index-enable ppmc.0.encoder.04.index-enable

It would still be the 4 axis on my encoder card which makes me think I need to move it to axis 3 as its 0,1,2,3

I dont have the actual 4th "A" setup yet, that will be in the future, but I need more hardware for that

I think in my motion.hal files I need to add all the info for the spindle axis also. What I have tried so far has not been successful.


# connect position feedback signals to encoders
net Xpos-fb <= ppmc.0.encoder.00.position
net Ypos-fb <= ppmc.0.encoder.01.position
net Zpos-fb <= ppmc.0.encoder.02.position
#net Apos-fb <= ppmc.0.encoder.03.position
#net Spos-fb <= ppmc.0.encoder.04.position

# get feedback scaling from ini file
setp ppmc.0.encoder.00.scale [AXIS_0]INPUT_SCALE
setp ppmc.0.encoder.01.scale [AXIS_1]INPUT_SCALE
setp ppmc.0.encoder.02.scale [AXIS_2]INPUT_SCALE
#setp ppmc.0.encoder.03.scale [AXIS_3]INPUT_SCALE
#net ppmc.0.encoder.04.scale [AXIS_4] INPUT_SCALE

# connect PID output signals to step generators
net Xoutput => ppmc.0.DAC.00.value
net Youtput => ppmc.0.DAC.01.value
net Zoutput => ppmc.0.DAC.02.value
#net Aoutput => ppmc.0.DAC.03.value

# set output scaling from ini file
setp ppmc.0.DAC.00.scale [AXIS_0]OUTPUT_SCALE
setp ppmc.0.DAC.01.scale [AXIS_1]OUTPUT_SCALE
setp ppmc.0.DAC.02.scale [AXIS_2]OUTPUT_SCALE
#setp ppmc.0.DAC.03.scale [AXIS_3]OUTPUT_SCALE

# set slowest velocity for estimation
setp ppmc.0.encoder.00.min-speed-estimate 0.001
setp ppmc.0.encoder.01.min-speed-estimate 0.001
setp ppmc.0.encoder.02.min-speed-estimate 0.001
#setp ppmc.0.encoder.03.min-speed-estimate 0.001

# Here's the part that connects the encoder velocity to the PID
net Xfbderiv ppmc.0.encoder.00.velocity pid.0.feedback-deriv
net Yfbderiv ppmc.0.encoder.01.velocity pid.1.feedback-deriv
net Zfbderiv ppmc.0.encoder.02.velocity pid.2.feedback-deriv
#net Afbderiv ppmc.0.encoder.03.velocity pid.3.feedback-deriv

# add a couple of tuning test links
# if these are useful will want to add them to the other axes as well
# or make these setup with the tuning script
net Xoutput ddt.0.in
net Xpos-fb ddt.1.in

# hook up motion controller's sync output
net spindle-index-en ppmc.0.encoder.04.index-enable motion.spindle-index-enable

# report rev count to motion controller
net spindle-pos ppmc.0.encoder.04.position  motion.spindle-revs

# set up 4th DAC generator as a spindle speed control
newsig spindle-speed float
newsig spindle-DAC-cmd float
newsig spindle-DAC-filt float
newsig spindle-DAC-abs float
net spindle-speed  motion.spindle-speed-out  mult2.1.in0
setp   mult2.1.in1 0.002457
net spindle-DAC-cmd  mult2.1.out lowpass.0.in
net spindle-DAC-filt lowpass.0.out => abs.0.in
setp lowpass.0.gain 0.005
net spindle-DAC-abs abs.0.out  ppmc.0.DAC.03.value
setp ppmc.0.encoder.04.scale 5000


# spindle speed display
addf lowpass.1 servo-thread
net spinraw    ppmc.0.encoder.04.delta conv-s32-float.0.in
net spinfloat  conv-s32-float.0.out mult2.0.in0
setp   mult2.0.in1 0.012            # (60/5000/rev)
net rawSpindleRPM mult2.0.out => lowpass.1.in
setp lowpass.1.gain 0.02
newsig  SpindleRPM float
linkps lowpass.1.out => SpindleRPM


Thanks again everyone!

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

Moderators: PCWjmelson
Time to create page: 0.122 seconds
Powered by Kunena Forum