Orientation position problem after run Gcode

More
21 Sep 2023 10:12 #281288 by abdulasis12
Hi
My Board is 7i96s + 7i77
I use Encoder 05 from 7i77 setup to spindle Encoder
#*******************
#  SPINDLE S
#*******************
setp   pid.s.Pgain     [SPINDLE_9]P
setp   pid.s.Igain     [SPINDLE_9]I
setp   pid.s.Dgain     [SPINDLE_9]D
setp   pid.s.bias      [SPINDLE_9]BIAS
setp   pid.s.FF0       [SPINDLE_9]FF0
setp   pid.s.FF1       [SPINDLE_9]FF1
setp   pid.s.FF2       [SPINDLE_9]FF2
setp   pid.s.deadband  [SPINDLE_9]DEADBAND
setp   pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp   pid.s.error-previous-target true
setp   orient-pid.Pgain     [SPINDLE_ORIENT]P
setp   orient-pid.Igain     [SPINDLE_ORIENT]I
setp   orient-pid.Dgain     [SPINDLE_ORIENT]D
setp   orient-pid.bias      [SPINDLE_ORIENT]BIAS
setp   orient-pid.FF0       [SPINDLE_ORIENT]FF0
setp   orient-pid.FF1       [SPINDLE_ORIENT]FF1
setp   orient-pid.FF2       [SPINDLE_ORIENT]FF2
setp   orient-pid.deadband  [SPINDLE_ORIENT]DEADBAND
setp   orient-pid.maxoutput [SPINDLE_ORIENT]MAX_OUTPUT
setp   orient-pid.error-previous-target true
net spindle-index-enable   <=> pid.s.index-enable <=> orient-pid.index-enable
net spindle-motion-enable      spindle.0.on  =>  pid.s.enable => spindle-enable-or.in0
net spindle-vel-cmd-rpm     => pid.s.command
net spindle-vel-fb-rpm      => pid.s.feedback
net spindle-vel-output pid.s.output orient-mux.in0
net spindle-output         <=  orient-mux.out
# ---PWM Generator signals/setup---
setp   hm2_7i96s.0.7i77.0.1.analogout5-scalemax  [SPINDLE_9]OUTPUT_SCALE
setp   hm2_7i96s.0.7i77.0.1.analogout5-minlim    [SPINDLE_9]OUTPUT_MIN_LIMIT
setp   hm2_7i96s.0.7i77.0.1.analogout5-maxlim    [SPINDLE_9]OUTPUT_MAX_LIMIT
net spindle-output      => hm2_7i96s.0.7i77.0.1.analogout5
net spindle-enable      => hm2_7i96s.0.7i77.0.1.spinena
# ---Encoder feedback signals/setup---
setp    hm2_7i96s.0.encoder.05.counter-mode 0
setp    hm2_7i96s.0.encoder.05.filter 1
setp    hm2_7i96s.0.encoder.05.index-invert 0
setp    hm2_7i96s.0.encoder.05.index-mask 0
setp    hm2_7i96s.0.encoder.05.index-mask-invert 0
setp    hm2_7i96s.0.encoder.05.scale  [SPINDLE_9]ENCODER_SCALE
net spindle-revs             <=   hm2_7i96s.0.encoder.05.position
net spindle-vel-fb-rps       <=   hm2_7i96s.0.encoder.05.velocity
net spindle-index-enable     <=>  hm2_7i96s.0.encoder.05.index-enable
# ---setup spindle control signals---
net spindle-vel-cmd-rps        <=  spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs    <=  spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm        <=  spindle.0.speed-out
net spindle-vel-cmd-rpm-abs    <=  spindle.0.speed-out-abs
net spindle-enable-or-out spindle-enable-or.in1 spindle-enable-xor.out
net spindle-enable             <=  spindle-enable-or.out
net spindle-cw                 <=  spindle.0.forward
net spindle-ccw                <=  spindle.0.reverse
net spindle-brake              <=  spindle.0.brake
net spindle-revs               =>  spindle.0.revs
net spindle-at-speed           =>  spindle.0.at-speed
net spindle-vel-fb-rps         =>  spindle.0.speed-in
net spindle-index-enable      <=>  spindle.0.index-enable
net spindle-is-oriented        =>  spindle.0.is-oriented
net spindle-orient-fault       =>  spindle.0.orient-fault
net spindle-locked             <=  spindle.0.locked
net spindle-locked             =>  spindle-enable-xor.in0 => orient-mux-or.in1
net orient-angle spindle.0.orient-angle orient.angle
net orient-mode spindle.0.orient-mode orient.mode
net orient-enable spindle.0.orient => orient.enable orient-mux-or.in0 spindle-enable-xor.in1
net orient-mux-sel orient-mux-or.out orient-mux.sel orient-pid.enable
net spindle-revs => orient.position orient-pid.feedback near-spindle.in2
net orient-command orient.command orient-pid.command near-spindle.in1
setp near-spindle.difference 0.01
#setp near-spindle.difference 0.5
#setp near-spindle.difference 1.5
#mux for switching between velocity and position pid output for the spindle#
net spindle-pos-output orient-pid.output orient-mux.in1
net spindle-near near-spindle.out => debounce.0.0.in
setp debounce.0.delay 20
#setp debounce.0.delay 50
net spindle-is-oriented-and0  <= debounce.0.0.out
net spindle-is-oriented-and0  => spindle-is-oriented-and.in0
net orient-enable             => spindle-is-oriented-and.in1
net spindle-is-oriented-edge  <= spindle-is-oriented-and.out
net spindle-is-oriented-edge  => edge.0.in
net spindle-is-oriented       <= edge.0.out
# rising edge
#setp edge.0.in-edge false
setp edge.0.in-edge true
# only rising edge
#setp edge.0.both false
setp edge.0.both true
#output pulse length
setp edge.0.out-width-ns 10000000
#home the spindle during first revolution
sets spindle-index-enable true
#fault on unhomed spindle
#net spindle-orient-fault      <= spindle.0.index-enablenet spindle-orient-fault      <= spindle.0.index-enable

# ---Setup spindle at speed signals---
sets spindle-at-speed true

First open linuxcnc program I will m3 s200 for index spindle setup.
I try M19 r0 it's move correct position on my mark Blue color on spindle
 


then I run file .ngc about 2minuts after gcode run completed I type M19 r0  , it's wrong position
why it's wrong position after run Gcode 2mins ?
 


I think , how for reset index spindle and I will m3 s200 for get new index spindle before ATC every time ?
or any solution for fix this problem ?

 

File Attachment:

File Name: 01.ngc
File Size:9 KB

 
Attachments:

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

More
21 Sep 2023 12:02 #281297 by Aciera
Sounds like your spindle orientation is maybe not setup correctly.

For example you have 'orient-mux-or' component in your hal but I don't see the 'orient-mux-or.sel' used in the section you posted. Doesn't necessarily mean it's a problem but might be.
The following user(s) said Thank You: abdulasis12

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

More
21 Sep 2023 13:10 #281303 by abdulasis12

Sounds like your spindle orientation is maybe not setup correctly.

For example you have 'orient-mux-or' component in your hal but I don't see the 'orient-mux-or.sel' used in the section you posted. Doesn't necessarily mean it's a problem but might be.

loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_dio=34
loadrt hostmot2
loadusr io
loadrt hm2_eth board_ip="10.10.10.10" config=" num_encoders=6 num_pwmgens=0 num_stepgens=5 sserial_port_0=000000"
setp   hm2_7i96s.0.watchdog.timeout_ns 10000000
loadrt pid names=pid.x,pid.y,pid.z,pid.a,pid.s,orient-pid
loadrt orient names=orient
loadrt mux2 names=orient-mux,z-limit-mux
loadrt or2 names=orient-mux-or,spindle-enable-or,atc-out-or,cam-out-or
loadrt xor2 names=spindle-enable-xor
loadrt near names=near-spindle
loadrt debounce cfg=1
loadrt edge count=1
loadrt and2 names=spindle-is-oriented-and,probe-and
loadrt bitwise names=probe-comp
loadrt conv_s32_u32 names=conv1

This tight ?

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

More
21 Sep 2023 13:13 #281304 by abdulasis12
my hall file :
# Generated by PNCconf at Tue Feb 18 06:20:29 2020
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_dio=34
loadrt hostmot2
loadusr io
loadrt hm2_eth board_ip="10.10.10.10" config=" num_encoders=6 num_pwmgens=0 num_stepgens=5 sserial_port_0=000000"
setp   hm2_7i96s.0.watchdog.timeout_ns 10000000
loadrt pid names=pid.x,pid.y,pid.z,pid.a,pid.s,orient-pid
loadrt orient names=orient
loadrt mux2 names=orient-mux,z-limit-mux
loadrt or2 names=orient-mux-or,spindle-enable-or,atc-out-or,cam-out-or
loadrt xor2 names=spindle-enable-xor
loadrt near names=near-spindle
loadrt debounce cfg=1
loadrt edge count=1
loadrt and2 names=spindle-is-oriented-and,probe-and
loadrt bitwise names=probe-comp
loadrt conv_s32_u32 names=conv1

addf hm2_7i96s.0.read            servo-thread
addf motion-command-handler     servo-thread
addf motion-controller          servo-thread
addf z-limit-mux        servo-thread
addf pid.x.do-pid-calcs         servo-thread
addf pid.y.do-pid-calcs         servo-thread
addf pid.z.do-pid-calcs         servo-thread
addf pid.a.do-pid-calcs         servo-thread
addf pid.s.do-pid-calcs         servo-thread
addf orient-pid.do-pid-calcs    servo-thread
addf hm2_7i96s.0.write           servo-thread


setp hm2_7i96s.0.dpll.01.timer-us -50
setp hm2_7i96s.0.stepgen.timer-number 1


addf orient         servo-thread
addf orient-mux         servo-thread
addf orient-mux-or      servo-thread
addf spindle-enable-or      servo-thread
addf spindle-enable-xor         servo-thread
addf near-spindle       servo-thread
addf debounce.0             servo-thread
addf edge.0         servo-thread
addf spindle-is-oriented-and    servo-thread
addf probe-and          servo-thread
addf conv1          servo-thread
addf atc-out-or                 servo-thread
addf cam-out-or                 servo-thread

# motion controller IO:
net tool-change-confirmed motion.digital-out-00 => iocontrol.0.tool-changed
# switch atc ranges from toolchange subroutine
net z-limit-select motion.digital-out-01        => z-limit-mux.sel
# spindle index pulse wired to motion controller
net spindle-index-enable                        => motion.digital-in-01
     
# atc-home
net atc-home         motion.digital-in-16       <=  hm2_7i96s.0.7i77.0.0.input-07
net atc-home                                   =>  hm2_7i96s.0.7i77.0.0.output-02
# atc-range
net atc-range                                   <=  hm2_7i96s.0.7i77.0.0.input-06
# atc-direction
net atc-direction    motion.digital-out-04      =>  hm2_7i96s.0.7i77.0.0.output-03
# atc-run
net atc-run          motion.digital-out-03      => hm2_7i96s.0.7i77.0.0.output-04
#net atc-run          motion.digital-out-03      =>  atc-out-or.in0
#net atc-out-or       atc-out-or.out             =>  hm2_7i96s.0.7i77.0.0.output-04
# atc-dec
#net atc-dec          atc-out-or.in1             <=  hm2_7i96s.0.7i77.0.0.input-16
# encoder atc
net atc-enc-1 motion.digital-in-11              <=  hm2_7i96s.0.7i77.0.0.input-11
net atc-enc-2 motion.digital-in-12              <=  hm2_7i96s.0.7i77.0.0.input-12
net atc-enc-3 motion.digital-in-13              <=  hm2_7i96s.0.7i77.0.0.input-13
net atc-enc-4 motion.digital-in-14              <=  hm2_7i96s.0.7i77.0.0.input-14
net atc-enc-5 motion.digital-in-10              <=  hm2_7i96s.0.7i77.0.0.input-15
# optical probe interface wired to motion controller for atc probe activation
#net probe-touch-reset  motion.digital-out-02   <= hm2_7i96s.0.7i77.0.0.output-01
#net probe-touch-in     motion.digital-in-18
#net probe-touch-error  motion.digital-in-19
# --- ESTOP-OUT ---
#net estop-out  =>     hm2_7i96s.0.7i77.0.0.output-00
# --- ESTOP-EXT ---
net estop-ext     <=  hm2_7i96s.0.7i77.0.0.input-31

# --- ESTOP-EXT ---
#net estop-ext     <=  hm2_7i96s.0.7i77.0.0.input-01
# --- SPINDLE-ENABLE ---
#net spindle-enable  =>     hm2_7i96s.0.ssr.00.out-00
# --- MACHINE-IS-ENABLED ---Spindle_On
net machine-is-enabled  =>     hm2_7i96s.0.7i77.0.0.output-00
# --- MACHINE-IS-ENABLED ---Servo_OUT
#net machine-is-enabled  =>     hm2_7i96s.0.7i77.0.0.output-09
# --- MACHINE-IS-ENABLED ---Servo A_OUT
#net machine-is-enabled  =>     hm2_7i96s.0.7i77.0.0.output-15
# --- MACHINE-IS-ENABLED ---Z brake
#net machine-is-enabled  =>     hm2_7i96s.0.7i77.0.0.output-01

# --- COOLANT-MIST ---
#net coolant-mist  =>     hm2_7i96s.0.7i77.0.0.output-06
#net coolant-mist  =>     hm2_7i96s.0.7i77.0.0.output-00
# --- COOLANT-FLOOD ---
net coolant-flood  =>     hm2_7i96s.0.7i77.0.0.output-05

# --- MAX-X ---
net max-x     <=  hm2_7i96s.0.7i77.0.0.input-01-not
# --- MIN-X ---
net min-x     <=  hm2_7i96s.0.7i77.0.0.input-00-not
# --- MAX-Y ---
net max-y     <=  hm2_7i96s.0.7i77.0.0.input-03-not
# --- MIN-Y ---
net min-y     <=  hm2_7i96s.0.7i77.0.0.input-02-not
# --- MAX-Z ---
net max-z     <=  hm2_7i96s.0.7i77.0.0.input-05-not
# --- MIN-Z ---
net min-z     <=  hm2_7i96s.0.7i77.0.0.input-04-not
# --- HOME-X ---
net home-x     <=  hm2_7i96s.0.7i77.0.0.input-08
# --- HOME-Y ---
net home-y     <=  hm2_7i96s.0.7i77.0.0.input-09
# --- HOME-Z ---
#net home-z     <=  hm2_7i96s.0.7i77.0.0.input-10
# --- HOME-A ---
#net a-home-sw    <=  hm2_7i96s.0.7i77.0.0.input-31-not
#*******************
#  AXIS X JOINT 0
#*******************
setp   pid.x.Pgain     [JOINT_0]P
setp   pid.x.Igain     [JOINT_0]I
setp   pid.x.Dgain     [JOINT_0]D
setp   pid.x.bias      [JOINT_0]BIAS
setp   pid.x.FF0       [JOINT_0]FF0
setp   pid.x.FF1       [JOINT_0]FF1
setp   pid.x.FF2       [JOINT_0]FF2
setp   pid.x.deadband  [JOINT_0]DEADBAND
setp   pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp   pid.x.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp   pid.x.maxerror 0.012700
net x-index-enable  => pid.x.index-enable
net x-enable        =>  pid.x.enable
net x-pos-cmd       =>  pid.x.command
net x-vel-cmd       =>  pid.x.command-deriv
net x-pos-fb        =>  pid.x.feedback
net x-output        <=  pid.x.output
# Step Gen signals/setup
setp   hm2_7i96s.0.stepgen.00.dirsetup        [JOINT_0]DIRSETUP
setp   hm2_7i96s.0.stepgen.00.dirhold         [JOINT_0]DIRHOLD
setp   hm2_7i96s.0.stepgen.00.steplen         [JOINT_0]STEPLEN
setp   hm2_7i96s.0.stepgen.00.stepspace       [JOINT_0]STEPSPACE
setp   hm2_7i96s.0.stepgen.00.position-scale  [JOINT_0]STEP_SCALE
setp   hm2_7i96s.0.stepgen.00.step_type        0
setp   hm2_7i96s.0.stepgen.00.control-type     1
setp   hm2_7i96s.0.stepgen.00.maxaccel         [JOINT_0]STEPGEN_MAXACCEL
setp   hm2_7i96s.0.stepgen.00.maxvel           [JOINT_0]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net x-pos-cmd    <= joint.0.motor-pos-cmd
net x-vel-cmd    <= joint.0.vel-cmd
net x-output     => hm2_7i96s.0.stepgen.00.velocity-cmd
net x-pos-fb     <= hm2_7i96s.0.stepgen.00.position-fb
net x-pos-fb     => joint.0.motor-pos-fb
net x-enable     <= joint.0.amp-enable-out
net x-enable     => hm2_7i96s.0.stepgen.00.enable
# ---setup home / limit switch signals---
net home-x    =>  joint.0.home-sw-in
net min-x     =>  joint.0.neg-lim-sw-in
net max-x     =>  joint.0.pos-lim-sw-in

# ---Encoder feedback signals/setup---

setp    hm2_7i96s.0.encoder.00.counter-mode 0
setp    hm2_7i96s.0.encoder.00.filter 1
setp    hm2_7i96s.0.encoder.00.index-invert 0
setp    hm2_7i96s.0.encoder.00.index-mask 0
setp    hm2_7i96s.0.encoder.00.index-mask-invert 0
setp    hm2_7i96s.0.encoder.00.scale  [JOINT_0]ENCODER_SCALE
#net x-pos-fb               <=  hm2_7i96s.0.encoder.00.position
net x-vel-fb               <=  hm2_7i96s.0.encoder.00.velocity
net x-pos-fb               =>  joint.0.motor-pos-fb
net x-index-enable    joint.0.index-enable  <=>  hm2_7i96s.0.encoder.00.index-enable
net x-pos-rawcounts        <=  hm2_7i96s.0.encoder.00.rawcounts



#*******************
#  AXIS Y JOINT 1
#*******************
setp   pid.y.Pgain     [JOINT_1]P
setp   pid.y.Igain     [JOINT_1]I
setp   pid.y.Dgain     [JOINT_1]D
setp   pid.y.bias      [JOINT_1]BIAS
setp   pid.y.FF0       [JOINT_1]FF0
setp   pid.y.FF1       [JOINT_1]FF1
setp   pid.y.FF2       [JOINT_1]FF2
setp   pid.y.deadband  [JOINT_1]DEADBAND
setp   pid.y.maxoutput [JOINT_1]MAX_OUTPUT
setp   pid.y.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp   pid.y.maxerror 0.012700
net y-index-enable  =>  pid.y.index-enable
net y-enable        =>  pid.y.enable
net y-pos-cmd       =>  pid.y.command
net y-vel-cmd       =>  pid.y.command-deriv
net y-pos-fb        =>  pid.y.feedback
net y-output        <=  pid.y.output
# Step Gen signals/setup
setp   hm2_7i96s.0.stepgen.01.dirsetup        [JOINT_1]DIRSETUP
setp   hm2_7i96s.0.stepgen.01.dirhold         [JOINT_1]DIRHOLD
setp   hm2_7i96s.0.stepgen.01.steplen         [JOINT_1]STEPLEN
setp   hm2_7i96s.0.stepgen.01.stepspace       [JOINT_1]STEPSPACE
setp   hm2_7i96s.0.stepgen.01.position-scale  [JOINT_1]STEP_SCALE
setp   hm2_7i96s.0.stepgen.01.step_type        0
setp   hm2_7i96s.0.stepgen.01.control-type     1
setp   hm2_7i96s.0.stepgen.01.maxaccel         [JOINT_1]STEPGEN_MAXACCEL
setp   hm2_7i96s.0.stepgen.01.maxvel           [JOINT_1]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net y-pos-cmd    <= joint.1.motor-pos-cmd
net y-vel-cmd    <= joint.1.vel-cmd
net y-output     => hm2_7i96s.0.stepgen.01.velocity-cmd
net y-pos-fb     <= hm2_7i96s.0.stepgen.01.position-fb
net y-pos-fb     => joint.1.motor-pos-fb
net y-enable     <= joint.1.amp-enable-out
net y-enable     => hm2_7i96s.0.stepgen.01.enable
net y-pos-rawcounts        <=  hm2_7i96s.0.encoder.01.rawcounts
# ---setup home / limit switch signals---
net home-y    =>  joint.1.home-sw-in
net min-y     =>  joint.1.neg-lim-sw-in
net max-y     =>  joint.1.pos-lim-sw-in

# ---Encoder feedback signals/setup---
setp    hm2_7i96s.0.encoder.01.counter-mode 0
setp    hm2_7i96s.0.encoder.01.filter 1
setp    hm2_7i96s.0.encoder.01.index-invert 0
setp    hm2_7i96s.0.encoder.01.index-mask 0
setp    hm2_7i96s.0.encoder.01.index-mask-invert 0
setp    hm2_7i96s.0.encoder.01.scale  [JOINT_1]ENCODER_SCALE
#net y-pos-fb               <=  hm2_7i96s.0.encoder.01.position
net y-vel-fb               <=  hm2_7i96s.0.encoder.01.velocity
net y-pos-fb               =>  joint.1.motor-pos-fb
net y-index-enable    joint.1.index-enable  <=>  hm2_7i96s.0.encoder.01.index-enable
net y-pos-rawcounts        <=  hm2_7i96s.0.encoder.01.rawcounts
#*******************
#  AXIS Z JOINT 2
#*******************
setp   pid.z.Pgain     [JOINT_2]P
setp   pid.z.Igain     [JOINT_2]I
setp   pid.z.Dgain     [JOINT_2]D
setp   pid.z.bias      [JOINT_2]BIAS
setp   pid.z.FF0       [JOINT_2]FF0
setp   pid.z.FF1       [JOINT_2]FF1
setp   pid.z.FF2       [JOINT_2]FF2
setp   pid.z.deadband  [JOINT_2]DEADBAND
setp   pid.z.maxoutput [JOINT_2]MAX_OUTPUT
setp   pid.z.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp   pid.z.maxerror 0.012700
net z-index-enable  =>  pid.z.index-enable
net z-enable        =>  pid.z.enable
net z-pos-cmd       =>  pid.z.command
#net z-vel-cmd       =>  pid.z.command-deriv
net z-pos-fb        =>  pid.z.feedback
net z-output        <=  pid.z.output
# Step Gen signals/setup
setp   hm2_7i96s.0.stepgen.02.dirsetup        [JOINT_2]DIRSETUP
setp   hm2_7i96s.0.stepgen.02.dirhold         [JOINT_2]DIRHOLD
setp   hm2_7i96s.0.stepgen.02.steplen         [JOINT_2]STEPLEN
setp   hm2_7i96s.0.stepgen.02.stepspace       [JOINT_2]STEPSPACE
setp   hm2_7i96s.0.stepgen.02.position-scale  [JOINT_2]STEP_SCALE
setp   hm2_7i96s.0.stepgen.02.step_type        0
setp   hm2_7i96s.0.stepgen.02.control-type     1
setp   hm2_7i96s.0.stepgen.02.maxaccel         [JOINT_2]STEPGEN_MAXACCEL
setp   hm2_7i96s.0.stepgen.02.maxvel           [JOINT_2]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net z-pos-cmd    <= joint.2.motor-pos-cmd
net z-vel-cmd    <= joint.2.vel-cmd
net z-output     => hm2_7i96s.0.stepgen.02.velocity-cmd
net z-pos-fb     <= hm2_7i96s.0.stepgen.02.position-fb
net z-pos-fb     => joint.2.motor-pos-fb
net z-enable     <= joint.2.amp-enable-out
net z-enable     => hm2_7i96s.0.stepgen.02.enable
# ---setup home / limit switch signals---
net atc-range     =>  joint.2.home-sw-in
#net home-z    =>  joint.2.home-sw-in
net min-z     =>  joint.2.neg-lim-sw-in
net max-z     =>  joint.2.pos-lim-sw-in
# switch z-axis soft limits
setp z-limit-mux.in0 [JOINT_2]MAX_LIMIT
setp z-limit-mux.in1 [JOINT_2]MAX_LIMIT_ATC
net z-limit-out <= z-limit-mux.out
# ini.2.max_limit is connectedd in custom_postgui.hal
# ---setup home / limit switch signals---
net a-home-sw     =>  joint.3.home-sw-in
net a-neg-limit     =>  joint.3.neg-lim-sw-in
net a-pos-limit     =>  joint.3.pos-lim-sw-in
#MPG ENC
#setp    hm2_7i96s.0.encoder.04.counter-mode 0
#setp    hm2_7i96s.0.encoder.04.scale  [JOINT_4]ENCODER_SCALE

# ---Encoder feedback signals/setup---
net y-pos-rawcounts        <=  hm2_7i96s.0.encoder.01.rawcounts
setp    hm2_7i96s.0.encoder.02.counter-mode 0
setp    hm2_7i96s.0.encoder.02.filter 1
setp    hm2_7i96s.0.encoder.02.index-invert 0
setp    hm2_7i96s.0.encoder.02.index-mask 0
setp    hm2_7i96s.0.encoder.02.index-mask-invert 0
setp    hm2_7i96s.0.encoder.02.scale  [JOINT_2]ENCODER_SCALE
#net z-pos-fb               <=  hm2_7i96s.0.encoder.02.position
net z-vel-fb               <=  hm2_7i96s.0.encoder.02.velocity
net z-pos-fb               =>  joint.2.motor-pos-fb
net z-index-enable    joint.2.index-enable  <=>  hm2_7i96s.0.encoder.02.index-enable
net y-pos-rawcounts        <=  hm2_7i96s.0.encoder.01.rawcounts

#*******************
#  SPINDLE S
#*******************
setp   pid.s.Pgain     [SPINDLE_9]P
setp   pid.s.Igain     [SPINDLE_9]I
setp   pid.s.Dgain     [SPINDLE_9]D
setp   pid.s.bias      [SPINDLE_9]BIAS
setp   pid.s.FF0       [SPINDLE_9]FF0
setp   pid.s.FF1       [SPINDLE_9]FF1
setp   pid.s.FF2       [SPINDLE_9]FF2
setp   pid.s.deadband  [SPINDLE_9]DEADBAND
setp   pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp   pid.s.error-previous-target true
setp   orient-pid.Pgain     [SPINDLE_ORIENT]P
setp   orient-pid.Igain     [SPINDLE_ORIENT]I
setp   orient-pid.Dgain     [SPINDLE_ORIENT]D
setp   orient-pid.bias      [SPINDLE_ORIENT]BIAS
setp   orient-pid.FF0       [SPINDLE_ORIENT]FF0
setp   orient-pid.FF1       [SPINDLE_ORIENT]FF1
setp   orient-pid.FF2       [SPINDLE_ORIENT]FF2
setp   orient-pid.deadband  [SPINDLE_ORIENT]DEADBAND
setp   orient-pid.maxoutput [SPINDLE_ORIENT]MAX_OUTPUT
setp   orient-pid.error-previous-target true
net spindle-index-enable   <=> pid.s.index-enable <=> orient-pid.index-enable
net spindle-motion-enable      spindle.0.on  =>  pid.s.enable => spindle-enable-or.in0
net spindle-vel-cmd-rpm     => pid.s.command
net spindle-vel-fb-rpm      => pid.s.feedback
net spindle-vel-output pid.s.output orient-mux.in0
net spindle-output         <=  orient-mux.out
# ---PWM Generator signals/setup---
setp   hm2_7i96s.0.7i77.0.1.analogout5-scalemax  [SPINDLE_9]OUTPUT_SCALE
setp   hm2_7i96s.0.7i77.0.1.analogout5-minlim    [SPINDLE_9]OUTPUT_MIN_LIMIT
setp   hm2_7i96s.0.7i77.0.1.analogout5-maxlim    [SPINDLE_9]OUTPUT_MAX_LIMIT
net spindle-output      => hm2_7i96s.0.7i77.0.1.analogout5
net spindle-enable      => hm2_7i96s.0.7i77.0.1.spinena
# ---Encoder feedback signals/setup---
setp    hm2_7i96s.0.encoder.05.counter-mode 0
setp    hm2_7i96s.0.encoder.05.filter 1
setp    hm2_7i96s.0.encoder.05.index-invert 0
setp    hm2_7i96s.0.encoder.05.index-mask 0
setp    hm2_7i96s.0.encoder.05.index-mask-invert 0
setp    hm2_7i96s.0.encoder.05.scale  [SPINDLE_9]ENCODER_SCALE
net spindle-revs             <=   hm2_7i96s.0.encoder.05.position
net spindle-vel-fb-rps       <=   hm2_7i96s.0.encoder.05.velocity
net spindle-index-enable     <=>  hm2_7i96s.0.encoder.05.index-enable
# ---setup spindle control signals---
net spindle-vel-cmd-rps        <=  spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs    <=  spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm        <=  spindle.0.speed-out
net spindle-vel-cmd-rpm-abs    <=  spindle.0.speed-out-abs
net spindle-enable-or-out spindle-enable-or.in1 spindle-enable-xor.out
net spindle-enable             <=  spindle-enable-or.out
net spindle-cw                 <=  spindle.0.forward
net spindle-ccw                <=  spindle.0.reverse
net spindle-brake              <=  spindle.0.brake
net spindle-revs               =>  spindle.0.revs
net spindle-at-speed           =>  spindle.0.at-speed
net spindle-vel-fb-rps         =>  spindle.0.speed-in
net spindle-index-enable      <=>  spindle.0.index-enable
net spindle-is-oriented        =>  spindle.0.is-oriented
net spindle-orient-fault       =>  spindle.0.orient-fault
net spindle-locked             <=  spindle.0.locked
net spindle-locked             =>  spindle-enable-xor.in0 => orient-mux-or.in1
net orient-angle spindle.0.orient-angle orient.angle
net orient-mode spindle.0.orient-mode orient.mode
net orient-enable spindle.0.orient => orient.enable orient-mux-or.in0 spindle-enable-xor.in1
net orient-mux-sel orient-mux-or.out orient-mux.sel orient-pid.enable
net spindle-revs => orient.position orient-pid.feedback near-spindle.in2
net orient-command orient.command orient-pid.command near-spindle.in1
setp near-spindle.difference 0.01
#setp near-spindle.difference 0.5
#setp near-spindle.difference 1.5
#mux for switching between velocity and position pid output for the spindle#
net spindle-pos-output orient-pid.output orient-mux.in1
net spindle-near near-spindle.out => debounce.0.0.in
setp debounce.0.delay 20
#setp debounce.0.delay 50
net spindle-is-oriented-and0  <= debounce.0.0.out
net spindle-is-oriented-and0  => spindle-is-oriented-and.in0
net orient-enable             => spindle-is-oriented-and.in1
net spindle-is-oriented-edge  <= spindle-is-oriented-and.out
net spindle-is-oriented-edge  => edge.0.in
net spindle-is-oriented       <= edge.0.out
# rising edge
#setp edge.0.in-edge false
setp edge.0.in-edge true
# only rising edge
#setp edge.0.both false
setp edge.0.both true
#output pulse length
setp edge.0.out-width-ns 10000000
#home the spindle during first revolution
sets spindle-index-enable true
#fault on unhomed spindle
#net spindle-orient-fault      <= spindle.0.index-enablenet spindle-orient-fault      <= spindle.0.index-enable

# ---Setup spindle at speed signals---
sets spindle-at-speed true
#******************************
# connect miscellaneous signals
#******************************
#  ---HALUI signals---
net axis-select-x  halui.axis.x.select
net jog-x-pos      halui.axis.x.plus
net jog-x-neg      halui.axis.x.minus
net jog-x-analog   halui.axis.x.analog
net x-is-homed     halui.joint.0.is-homed
net axis-select-y  halui.axis.y.select
net jog-y-pos      halui.axis.y.plus
net jog-y-neg      halui.axis.y.minus
net jog-y-analog   halui.axis.y.analog
net y-is-homed     halui.joint.1.is-homed
net axis-select-z  halui.axis.z.select
net jog-z-pos      halui.axis.z.plus
net jog-z-neg      halui.axis.z.minus
net jog-z-analog   halui.axis.z.analog
net z-is-homed     halui.joint.2.is-homed
net jog-selected-pos      halui.axis.selected.plus
net jog-selected-neg      halui.axis.selected.minus
net spindle-manual-cw     halui.spindle.0.forward
net spindle-manual-ccw    halui.spindle.0.reverse
net spindle-manual-stop   halui.spindle.0.stop
net machine-is-on         halui.machine.is-on
net jog-speed             halui.axis.jog-speed
net MDI-mode              halui.mode.is-mdi
#  ---coolant signals---
net coolant-mist      <=  iocontrol.0.coolant-mist
net coolant-flood     <=  iocontrol.0.coolant-flood
#  ---probe signal---
net probe-touch-in     =>  motion.probe-input
#  ---motion control signals---
net in-position               <=  motion.in-position
net machine-is-enabled        <=  motion.motion-enabled
#  ---digital in / out signals---
#  ---estop signals---
net estop-out     <=  iocontrol.0.user-enable-out
net estop-ext     =>  iocontrol.0.emc-enable-in


#  --- tool change signals---
net tool-prepare-loopback   iocontrol.0.tool-prepare     =>     iocontrol.0.tool-prepared


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

More
21 Sep 2023 13:46 #281310 by Aciera
Would be much better if you could attach the file rather than put the contents in the post.
The following user(s) said Thank You: abdulasis12

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

More
21 Sep 2023 14:58 #281318 by abdulasis12

Would be much better if you could attach the file rather than put the contents in the post.

Okay,
 

File Attachment:

File Name: 217-4x.hal
File Size:20 KB

 

File Attachment:

File Name: 217-4x.ini
File Size:7 KB
Attachments:

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

More
21 Sep 2023 15:52 #281321 by Aciera
Ah ok, it's actually an or2 component not a mux2 so that is fine then. I haven't gone over your hal in great detail and debugging spindle orientation can be a difficult task. Doing it remotely is very difficult indeed.

So the first thing I would suggest is to thoroughly test the spindle orient functionality by running the spindle and then do an M19 R0 then run the spindle again and do another M19 R0. You want this to work at least a hundred times using different spindle speeds and directions before moving on to other things.

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

More
21 Sep 2023 16:26 #281322 by abdulasis12

Ah ok, it's actually an or2 component not a mux2 so that is fine then. I haven't gone over your hal in great detail and debugging spindle orientation can be a difficult task. Doing it remotely is very difficult indeed.

So the first thing I would suggest is to thoroughly test the spindle orient functionality by running the spindle and then do an M19 R0 then run the spindle again and do another M19 R0. You want this to work at least a hundred times using different spindle speeds and directions before moving on to other things.Today

Hi MR.Aciera
Today I try to find this problem what or where to error
I try
 m3 s1000  5minuts
recheck m19 r0  it's ok
m3 s2000 5 minuts
m3 s3000 3-4 mins
m3 s4000 4mins
m3 s5000 5 mins
m3 s6000 5mins
m3 s7000 5mins
before go next m3 i will M19 r0 for check  , result = good

then I try run gcode about 1:30 - 2 mins
when gcode completed I try M19 r0  it's wrong position Orient.

Maybe I think when gcode run  servo motor XYZ and motor water pump start too, Maybe noise in to Encoder05 on 7i77 for made it's error tracking ?

Asis,

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

More
21 Sep 2023 18:30 #281326 by PCW
I would set the hm2_7i96s.0 encoder.05.quad-error-enable bit,
do your gcode test and see if hm2_7i96s.encoder.05.quad-error gets set true

Is the spindle encoder differential?
If so, is the 7I77 set for differential inputs?
The following user(s) said Thank You: abdulasis12

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

More
22 Sep 2023 02:04 #281342 by abdulasis12

I would set the hm2_7i96s.0 encoder.05.quad-error-enable bit,
do your gcode test and see if hm2_7i96s.encoder.05.quad-error gets set true

Is the spindle encoder differential?
If so, is the 7I77 set for differential inputs?

Hi MR.PCW
Yes, My spindle Encoder is Differential.

---- If so, is the 7I77 set for differential inputs?   
Hmmm, I not sure , How to recheck ?

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

Time to create page: 0.195 seconds
Powered by Kunena Forum