Adding a Mpg to a 7i85s

More
23 Apr 2018 14:40 #109490 by Clive S
I would like to add an Mpg to a mesa 5i25 port 2 with a 7i85s using encoder 1. I have come up with:-

############## The MPG input PINS on 7i85s encoder 1 ##############

net x-mpg-a encoder.1.phase-A <= hm2_5i25.0.encoder.01 input-a
net x-mpg-b encoder.1.phase-B <= hm2_5i25.0.encoder.01 input-b

setp encoder.0.x4-mode 0

# ---mpg signals---

# X Axis handwheel
setp axis.0.jog-vel-mode 0
net x-jog-enable => axis.0.jog-enable
net x-jog-count => axis.0.jog-counts
net jog-incr-x => axis.0.jog-scale
sets x-jog-enable true
sets jog-incr-x 0.01

Does this look OK to add to my custom.hal file. I have the spindle encoder working now on encoder 0. I also have set the encoders to 4 loaded.

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

More
23 Apr 2018 15:17 #109491 by PCW
Replied by PCW on topic Adding a Mpg to a 7i85s
It looks like you are using a software encoder, unless you need 1X mode, I would use the hardware encoders

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

More
23 Apr 2018 15:22 #109492 by Clive S
Replied by Clive S on topic Adding a Mpg to a 7i85s

It looks like you are using a software encoder, unless you need 1X mode, I would use the hardware encoders

Thanks for the quick response. I want to use the hardware encoders on the 7i85s Yes I forgot I copied some of the above from my mesa 7i76 pins 16,17 software on another machine. Could you point me in the right direction

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

More
23 Apr 2018 15:46 - 23 Apr 2018 15:47 #109495 by PCW
Replied by PCW on topic Adding a Mpg to a 7i85s
There are a couple of ways to do this, simplest would be to use

hm2_5i25.0.encoder.0N.count linked to axis.0.jog-counts:

net x-jog-count => axis.0.jog-counts <= hm2_5i25.0.encoder.0N.count

A fancier way would be to use the encoder position (which is floating point and scalable) and convert it to an integer (what axis.N.jog counts expects) to do 4X to 1X conversion if you have a detented jogwheel and want only 1 jog increment per detent
Last edit: 23 Apr 2018 15:47 by PCW.

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

More
23 Apr 2018 15:56 - 23 Apr 2018 17:03 #109496 by Clive S
Replied by Clive S on topic Adding a Mpg to a 7i85s

There are a couple of ways to do this, simplest would be to use

hm2_5i25.0.encoder.0N.count linked to axis.0.jog-counts:

net x-jog-count => axis.0.jog-counts <= hm2_5i25.0.encoder.0N.count

A fancier way would be to use the encoder position (which is floating point and scalable) and convert it to an integer (what axis.N.jog counts expects) to do 4X to 1X conversion if you have a detented jogwheel and want only 1 jog increment per detent


Yes I have an indented jog wheel and would like to change the increment just in the hal file with the scale.

So what then would be the commands to put in the custom hal file. before I get too confused :lol: Thanks
Last edit: 23 Apr 2018 17:03 by Clive S.

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

More
28 Apr 2018 12:45 - 28 Apr 2018 13:47 #109759 by Clive S
Replied by Clive S on topic Adding a Mpg to a 7i85s
Ok I have tried this in a custom hal file:-

net x-jog-count axis.0.jog-counts
net x-jog-count hm2_5i25.0.encoder.01.count

And looking with halmeter I can see hm2_5i25.0.encoder.01.count change and hm2_5i25.0.encoder.01.velocity change also xxxx.01.position change

What else do I need to add to get the mpg working please.

This is from the hal file:-
# X axis
# step/dir
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0
# velocity control
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.control-type 1

# scaling for position feedback, position command, and velocity command, in steps per length unit.
# converts from counts to position units. position = counts / position_scale
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-scale [AXIS_0]SCALE

# stepper driver timing parameters
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.steplen [AXIS_0]STEPLEN
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.stepspace [AXIS_0]STEPSPACE
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirhold [AXIS_0]DIRHOLD
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirsetup [AXIS_0]DIRSETUP

setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxvel [AXIS_0]STEPGEN_MAX_VEL
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL

# axis enable chain
newsig emcmot.00.enable bit
sets emcmot.00.enable FALSE

net emcmot.00.enable <= axis.0.amp-enable-out
net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.00.enable pid.0.enable

# position command and feedback
net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command
net emcmot.00.vel-cmd axis.0.joint-vel-cmd => pid.0.command-deriv
net motor.00.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-fb axis.0.motor-pos-fb pid.0.feedback
net motor.00.command pid.0.output hm2_[HOSTMOT2](BOARD).0.stepgen.00.velocity-cmd
setp pid.0.error-previous-target true

# PID parameters
setp pid.0.Pgain [AXIS_0]P
setp pid.0.Igain [AXIS_0]I
setp pid.0.Dgain [AXIS_0]D
setp pid.0.bias [AXIS_0]BIAS
setp pid.0.FF0 [AXIS_0]FF0
setp pid.0.FF1 [AXIS_0]FF1
setp pid.0.FF2 [AXIS_0]FF2
setp pid.0.deadband [AXIS_0]DEADBAND
setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT
setp pid.0.maxerror [AXIS_0]MAX_ERROR

# P3 pin 3 gpio 004
# X step
setp hm2_[HOSTMOT2](BOARD).0.gpio.004.invert_output 1
Last edit: 28 Apr 2018 13:47 by Clive S. Reason: added hal file

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

More
28 Apr 2018 13:51 #109761 by PCW
Replied by PCW on topic Adding a Mpg to a 7i85s
Some of your earlier hal snippets showed setting up jog enable and scale, are you still doing this?

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

More
28 Apr 2018 13:57 #109762 by Clive S
Replied by Clive S on topic Adding a Mpg to a 7i85s

Some of your earlier hal snippets showed setting up jog enable and scale, are you still doing this?


No I scrapped that part as I think you said it was to do with software encoders. So I have started from scratch.

The halmeter shows they are counting up and down etc. I think I need scale and jog enable etc. but not sure how to implement it .
Tnx for the help.

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

More
28 Apr 2018 14:09 - 28 Apr 2018 14:17 #109763 by PCW
Replied by PCW on topic Adding a Mpg to a 7i85s
Normally they would be wired (in hal) to external jog enable, jog increment (and perhaps axis select)
signals that come from hardware switches or buttons+logic, but for testing, you can "setp" the pins or "sets"
the jog enable and scale signals by hand.

MPG setup can get fairly involved, for example its quite common to add a low-pass filter component in series with the jog count so that larger jog increments are no so jarring (full accel starts and stops for each increment)
Last edit: 28 Apr 2018 14:17 by PCW.

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

More
28 Apr 2018 14:26 - 28 Apr 2018 18:07 #109765 by Clive S
Replied by Clive S on topic Adding a Mpg to a 7i85s

Normally they would be wired (in hal) to external jog enable, jog increment (and perhaps axis select)
signals that come from hardware switches or buttons+logic, but for testing, you can "setp" the pins or "sets"
the signals by hand.

I want to use a mpg on each axis. basically I just want to be able to jog without the keyboard or pendant.
I would like to take it one step at a time. I am putting this in a custom hal. to keep it separate. I believe that the jog wheels will only work when not running a prog. ie just like the keyboard jog.

so what else do I need to add to the custom hal. I have setp axis.0.jog-enable true (but it shows false in halmeter)
net x-jog-count axis.0.jog-counts
net x-jog-count hm2_5i25.0.encoder.01.count
setp axis.0.jog-enable true

..

setup can get fairly involved, for example its quite common to add a low-pass filter component in series with the jog count so that larger jog increments are no so jarring (full accel starts and stops for each increment)

Yes I have all this set up with a 5i25/7176 using software encoder and external increment switches etc. on another machine.
Last edit: 28 Apr 2018 18:07 by Clive S. Reason: added text

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

Time to create page: 0.172 seconds
Powered by Kunena Forum