On Thursday, 28 April 2022 18:00:12 EDT andy pugh wrote: > On Thu, 28 Apr 2022 at 21:14, gene heskett <[email protected]> wrote: > > To drive a couple comps to capture the number of steps issued to > > drive it exactly 100 full turns. > > Surely you already know that? It's 360 x 100 x SCALE ?
Sure Andy. But what is the scale? Thats what I'm trying to set. What I thought I was doing was recording the startiing data when the counter went past 4 from the stepgens.fb pin, letting it run with a large enough number that it will exceed 100 more turns, which then freezes the 2nd saved fb, subtract the first SHOULD give me to total steps frozen in the halmeter display. the fb at that point, subtract the first from the second, then /360 that, and /100 the remainder, should give the SCALE, but its off, a long ways. Orders of magnitude. This stuff is at the bottom of the attached hal file. Thank you Andy. > -- > atp > "A motorcycle is a bicycle with a pandemonium attachment and is > designed for the especial use of mechanical geniuses, daredevils and > lunatics." > — George Fitch, Atlanta Constitution Newspaper, 1912 > > > _______________________________________________ > Emc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-users Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis
# Generated by stepconf at Tue Jan 10 12:42:05 2012 # If you make changes to this file, they will be # overwritten when you run stepconf again loadrt [KINS]KINEMATICS #autoconverted trivkins loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_dio=12 loadrt hostmot2 loadrt hm2_pci config="num_pwmgens=1 num_stepgens=4 num_encoders= sserial_port_0=1xxx" loadrt abs count=2 loadrt timedelay count=4 loadrt xor2 count=2 #2nd one is mist-ctl loadrt and2 names=and-prb1,and-prb2,mist-ctl loadrt select8 count=1 loadrt scale names=scale60 loadrt limit3 names=tachfltr loadrt comp names=comp_cal0,comp_cal1 loadrt mux2 names=mux2cal0,mux2cal1,mux21B,mux22b loadrt updown names=b_cntr loadrt sum2 names=b_tally,sum2.0,sum2.1,sum2.2,sum2.3 loadrt edge names=edge.0 loadrt conv_s32_float names=S32_float-in,S32_float-cntr,S32_float-cal loadrt or2 names=fwdpul,revpul,spindle-run loadusr hy_vfd -d/dev/ttyUSB0 -b8 -s1 -pnone -r19200 -t1 -S24000 # Camview stuff IF ever find working camera #loadrt sum2 count=4 #base thread stuff is no more #servo thread stuff addf hm2_5i25.0.read_gpio servo-thread addf hm2_5i25.0.read servo-thread addf tachfltr servo-thread addf scale60 servo-thread addf select8.0 servo-thread # preset select8 addf and-prb1 servo-thread # detect contact(s) addf and-prb2 servo-thread # combine with select8.out5 addf motion-command-handler servo-thread addf motion-controller servo-thread addf abs.0 servo-thread addf abs.1 servo-thread addf timedelay.0 servo-thread addf xor2.0 servo-thread addf mux2cal0 servo-thread addf mux2cal1 servo-thread addf S32_float-in servo-thread addf S32_float-cntr servo-thread addf S32_float-cal servo-thread addf b_cntr servo-thread addf comp_cal0 servo-thread addf comp_cal1 servo-thread addf b_tally servo-thread # More Camview stuff addf sum2.0 servo-thread addf sum2.1 servo-thread addf sum2.2 servo-thread addf sum2.3 servo-thread addf edge.0 servo-thread addf timedelay.1 servo-thread # is rs485 enable timer addf timedelay.2 servo-thread addf xor2.1 servo-thread # turns mister on/off addf timedelay.3 servo-thread # mist oscillator addf revpul servo-thread addf fwdpul servo-thread addf spindle-run servo-thread # synth run signal addf hm2_5i25.0.write_gpio servo-thread addf hm2_5i25.0.write servo-thread #*************************************************** # setup spindle driver * #*************************************************** net spindle-cmd <= spindle.0.speed-out => abs.1.in # feed always + value to spinout net spindle-abs <= abs.1.out # => hm2_5i25.0.7i76.0.0.spinout # set a minimum speed to protect motor setp hm2_5i25.0.7i76.0.0.spinout-maxlim [SPINDLE_0]MAXREV_LIM setp hm2_5i25.0.7i76.0.0.spinout-minlim [SPINDLE_0]MINREV_LIM setp hm2_5i25.0.7i76.0.0.spinout-scalemax [SPINDLE_0]MAXREV_LIM net motor-power <= motion.motion-enabled net spindle-enable <= spindle.0.on # enable short pulse spindle forward net spindle-enable => fwdpul.in0 net spindle-ena1 <= fwdpul.out # => hm2_5i25.0.7i76.0.0.spinena # spindle fwd-rev to tallies but probably not found until hy_vfd is talking # so put most of this rs485 stuff in post-gui-rs485.hal net spindle-fwd <= spindle.0.forward #used in postgui.hal net spindle-fwd => spindle-run.in0 net spindle-rev <= spindle.0.reverse => revpul.in0 net spindle-rev => spindle-run.in1 net spinrev1 <= revpul.out # => hm2_5i25.0.7i76.0.0.spindir # temp,make the ors just buffers setp revpul.in1 false setp fwdpul.in1 false #************************************************************************* # input for probe, moved to 7i76 because C1G rev4 has blown chips * # field logic voltage is 12 volts, src pin of the probe is fed 12 volts. * # hook up probe signal but disable if motion type not 5 * #************************************************************************* net probe-in1 <= hm2_5i25.0.7i76.0.0.input-31 => and-prb1.in0 # s/b correct for plastic mechanical probe net probe-in2 <= hm2_5i25.0.7i76.0.0.input-30-not => and-prb1.in1 # see what default state is after wireiig a pullup to it # so we have an and2, which with the plastic closed, no contact # and probe2 open is a true output # and a ground contact touch, or the plastic touchin and open, the output is false, # with eitheer being a valid touch # once I had grounded the 6040 frame to the electronics ground.. net probe-ctl <= motion.motion-type => select8.0.sel # disable out5 if not probe move # now, combine the select8.out5 net probe-hit1 <= select8.0.out5 => and-prb2.in0 net probe-hit2 <= and-prb1.out => and-prb2.in1 net probe-hit <= and-prb2.out => motion.probe-input # but is this the correct polarity? #**************************************************************** # output for spindle coolant pump. Timedelays active now * # tie pump-ctrl to spindle-on with 300 second cooldown off delay* #**************************************************************** setp timedelay.0.on-delay 0.500 setp timedelay.0.off-delay 300 # 5 minutes net spindle-enable => timedelay.0.in net pump-ctrl <= timedelay.0.out => hm2_5i25.0.7i76.0.0.output-00 # spindle coolant pump # wired up relay to 7i76 output-00 #*************************************************************** # output for coolant-mist air ctrl - WORKS! Valve coil gets HOT net mist-on <= iocontrol.0.coolant-mist => hm2_5i25.0.7i76.0.0.output-01 # turns on tool mister air valv, and supplies pump 12 volts net mist-on => xor2.1.in0 # turn on pump motor speed control net osc-fdbck <= xor2.1.out => timedelay.3.in # make speed timer oscillator setp hm2_5i25.0.gpio.024.is_output true net mister-out <= timedelay.3.out => xor2.1.in1 net mister-out => hm2_5i25.0.gpio.024.out # to pump pwr control # note, get pump power from output of relay driven by 1st line above. # Otherwise pump runs when lcnc off #*************************************************************** # enable mister air separately so I can blow sawdust too net air-on <= iocontrol.0.coolant-flood => hm2_5i25.0.7i76.0.0.output-04 # above for straight relay control # set pwm freq where I can't hear it setp hm2_5i25.0.pwmgen.pwm_frequency [AIR_0]PWMGEN_S_FREQ # or enable of bts-7960 controller in new box net air-on => hm2_5i25.0.pwmgen.00.enable setp hm2_5i25.0.pwmgen.00.scale 1.0000 setp hm2_5i25.0.pwmgen.00.value .80000 #************** # for homeing * #************** # 1st cable to x home switch net home-x <= hm2_5i25.0.7i76.0.0.input-04 => joint.0.home-sw-in # wired now # 2nd cable to Y home switch net home-y <= hm2_5i25.0.7i76.0.0.input-06 => joint.1.home-sw-in # wired now # 3rd cable to Z home switch net home-z <= hm2_5i25.0.7i76.0.0.input-08 => joint.2.home-sw-in # wired now # 4th cable to B home swich net home-b <= hm2_5i25.0.7i76.0.0.input-10 => joint.3.home-sw-in # wired now # B is rotary, no limits # now unhome when motion is disabled by specing home is volatile in the ini file. # While at it, use motion-enabled to turn on machine and lights power # output sinks to ground, relay coil pwr src is 12v term strip net motor-power => hm2_5i25.0.7i76.0.0.output-02 #water pump, lights relay # break into 2nd power strip cord with relay contacts so everything on it is switched #feed 12+ to red wire in that cable to box under 250 volt socket net motor-power => hm2_5i25.0.7i76.0.0.output-03 # minus to SSR's for vfd power net motor-power => timedelay.1.in setp timedelay.1.on-delay 10 #seconds after motor power #************* # axis x stuff #************* setp hm2_5i25.0.stepgen.00.position-scale [JOINT_0]STEPSCALE setp hm2_5i25.0.stepgen.00.steplen [JOINT_0]STEPLEN setp hm2_5i25.0.stepgen.00.stepspace [JOINT_0]STEPSPACE setp hm2_5i25.0.stepgen.00.dirhold [JOINT_0]DIRHOLD setp hm2_5i25.0.stepgen.00.dirsetup [JOINT_0]DIRSETUP setp hm2_5i25.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAXACCEL net xpos-cmd joint.0.motor-pos-cmd => hm2_5i25.0.stepgen.00.position-cmd net xpos-fb hm2_5i25.0.stepgen.00.position-fb => joint.0.motor-pos-fb net xenable joint.0.amp-enable-out => hm2_5i25.0.stepgen.00.enable #************* # Y axis stuff #************* setp hm2_5i25.0.stepgen.01.position-scale [JOINT_1]STEPSCALE setp hm2_5i25.0.stepgen.01.steplen [JOINT_1]STEPLEN setp hm2_5i25.0.stepgen.01.stepspace [JOINT_1]STEPSPACE setp hm2_5i25.0.stepgen.01.dirhold [JOINT_1]DIRHOLD setp hm2_5i25.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP setp hm2_5i25.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAXACCEL net ypos-cmd joint.1.motor-pos-cmd => hm2_5i25.0.stepgen.01.position-cmd net ypos-fb hm2_5i25.0.stepgen.01.position-fb => joint.1.motor-pos-fb net yenable joint.1.amp-enable-out => hm2_5i25.0.stepgen.01.enable #************* # Z axis stuff #************* setp hm2_5i25.0.stepgen.02.position-scale [JOINT_2]STEPSCALE setp hm2_5i25.0.stepgen.02.steplen [JOINT_2]STEPLEN setp hm2_5i25.0.stepgen.02.stepspace [JOINT_2]STEPSPACE setp hm2_5i25.0.stepgen.02.dirhold [JOINT_2]DIRHOLD setp hm2_5i25.0.stepgen.02.dirsetup [JOINT_2]DIRSETUP setp hm2_5i25.0.stepgen.02.maxaccel [JOINT_2]STEPGEN_MAXACCEL net zpos-cmd <= joint.2.motor-pos-cmd => hm2_5i25.0.stepgen.02.position-cmd net zpos-fb <= hm2_5i25.0.stepgen.02.position-fb => joint.2.motor-pos-fb net zenable <= joint.2.amp-enable-out => hm2_5i25.0.stepgen.02.enable #************* # A or B axis stuff #************* # here I need a pullup to field power, say about 10k to 22k to give # a true reading when unplugged. net b-prsnt <= hm2_5i25.0.7i76.0.0.input-09 # high is it plugged in? # so first, go add that. setp hm2_5i25.0.stepgen.03.position-scale [JOINT_3]STEPSCALE setp hm2_5i25.0.stepgen.03.steplen [JOINT_3]STEPLEN setp hm2_5i25.0.stepgen.03.stepspace [JOINT_3]STEPSPACE setp hm2_5i25.0.stepgen.03.dirhold [JOINT_3]DIRHOLD setp hm2_5i25.0.stepgen.03.dirsetup [JOINT_3]DIRSETUP setp hm2_5i25.0.stepgen.03.maxaccel [JOINT_3]STEPGEN_MAXACCEL #this work for A o B #setp hm2_5i25.0.stepgen.04.position-scale [JOINT_3]STEPSCALE #setp hm2_5i25.0.stepgen.04.steplen [JOINT_3]STEPLEN #setp hm2_5i25.0.stepgen.04.stepspace [JOINT_3]STEPSPACE #setp hm2_5i25.0.stepgen.04.dirhold [JOINT_3]DIRHOLD #setp hm2_5i25.0.stepgen.04.dirsetup [JOINT_3]DIRSETUP #setp hm2_5i25.0.stepgen.04.maxaccel [JOINT_3]STEPGEN_MAXACCEL net bpos-cmd <= joint.3.motor-pos-cmd => hm2_5i25.0.stepgen.03.position-cmd #net bpos-cmd => hm2_5i25.0.stepgen.04.position-cmd net bpos-fb <= hm2_5i25.0.stepgen.03.position-fb => joint.3.motor-pos-fb net benable <= joint.3.amp-enable-out => hm2_5i25.0.stepgen.03.enable #net benable => hm2_5i25.0.stepgen.04.enable # eventually wire this up for motor power control like lathe but with a relay net estop-out <= iocontrol.0.user-enable-out net estop-out => iocontrol.0.emc-enable-in # Hook up, filter tach from vfd.hz-out at VO terminal. # Its a pwm intended to drive an analog tach needle net spdl-tach-raw <= hm2_5i25.0.7i76.0.0.analogin0 net spdl-tach-raw => tachfltr.in setp tachfltr.enable true setp scale60.gain 60 net spdl-tach-fltr <= tachfltr.out => scale60.in loadusr -W hal_manualtoolchange net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared #******************************************************************** # Now, to calibrate the B axis SCALE using steps performed per turn * # as reported by its passing the home-a switch mounted on it * # while tracking the steps as reported by bpos-fb * #******************************************************************** net bcalibrate0 <= mux2cal0.out => mux2cal0.in1 b_tally.in0 # make them into sample-holds net bcalibrate1 <= mux2cal1.out => mux2cal1.in1 b_tally.in1 # but here we'll probably need an edge detector because the switch is on for many cycles # watch counter to see if it does 500+ counts instead of one net home-b => b_cntr.countup # From b's home switch # but counter is an s32 and comp needs a float net btrackS32 <= b_cntr.count => S32_float-cntr.in net btrackfloat <= S32_float-cntr.out => comp_cal0.in1 comp_cal1.in1 # setup sum2 to subtract first count at 1 from 2nd at 101 setp b_tally.gain0 -.01000000 setp b_tally.gain1 .01000000 setp comp_cal0.in0 4.00000000 # count 2 turns setp comp_cal1.in0 104.00000000 # count 10 or 100 more turns net bpos-fb => mux2cal0.in0 mux2cal1.in0 # feed steps made to both sample-holds net shhold0 <= comp_cal0.out => mux2cal0.sel # freeze sample at 1 turn net shhold1 <= comp_cal1.out => mux2cal1.sel # freeze sample at 11 or 101 turns # read b_tally.out, /100 for B SCALE in the ini file # then comment all this stuff out, its done its job # CamView pins. nuke whole lot of this if good camera can't be found #to correct DRO we need to SUBTRACT tool.length_offsetS from pos-relative setp sum2.0.gain1 -1.00000000 setp sum2.1.gain1 -1.00000000 setp sum2.2.gain1 -1.00000000 setp sum2.3.gain1 -1.00000000 net sum20in0 halui.axis.x.pos-relative => sum2.0.in0 net sum21in0 halui.axis.y.pos-relative => sum2.1.in0 net sum22in0 halui.axis.z.pos-relative => sum2.2.in0 net sum23in0 halui.axis.b.pos-relative => sum2.3.in0 net sum20in1 halui.tool.length_offset.x => sum2.0.in1 net sum21in1 halui.tool.length_offset.y => sum2.1.in1 net sum22in1 halui.tool.length_offset.z => sum2.2.in1 net sum23in1 halui.tool.length_offset.b => sum2.3.in1 # might need empty net to have DRO happy net sum20out sum2.0.out net sum21out sum2.1.out net sum22out sum2.2.out net sum23out sum2.3.out # THE ABOVE IS JUNK AND SHOULD BE REMOVED! But tryiing it with new camera
_______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
