1 of 3 to output // 7i73 MPG not functioning

More
11 Sep 2017 15:27 - 14 Sep 2017 17:01 #98839 by tecno
Hi guys,

Tinkering of a mpg.hal file and I need some advice here.

Have 3 inputs and I want 1 output go TRUE if one of these inputs is TRUE.
How to do this? 2 XOR2's or what?

+ I want that output to be flashing also.

This is the file so far

# Jog Pendant
loadrt encoder num_chan=1
loadrt mux4 count=1
loadrt xor2 count=2
loadrt siggen num_chan=1
addf encoder.capture-position servo-thread
addf encoder.update-counters base-thread
addf mux4.0 servo-thread
addf xor2.0 servo-thread
addf siggen.0.update servo-thread

# If your MPG outputs a quadrature signal per click set x4 to 1
# If your MPG puts out 1 pulse per click set x4 to 0
setp encoder.0.x4-mode 0

# For velocity mode, set to 1
# In velocity mode the axis stops when the dial is stopped
# even if that means the commanded motion is not completed,
# For position mode (the default), set to 0
# In position mode the axis will move exactly jog-scale
# units for each count, regardless of how long that might take,
setp axis.0.jog-vel-mode 1
setp axis.1.jog-vel-mode 1
setp axis.2.jog-vel-mode 1

# This sets the scale that will be used based on the input to the mux4
setp mux4.0.in0 0.1
setp mux4.0.in1 0.01
setp mux4.0.in2 0.001

# The inputs to the mux4 component
net scale1 mux4.0.sel0 <= hm2_7i76e.0.7i73.0.1.input-01
net scale2 mux4.0.sel1 <= hm2_7i76e.0.7i73.0.1.input-02

# The output from the mux4 is sent to each axis jog scale
net mpg-scale <= mux4.0.out
net mpg-scale => axis.0.jog-scale
net mpg-scale => axis.1.jog-scale
net mpg-scale => axis.2.jog-scale

# The MPG inputs
net mpg-a encoder.0.phase-A <= hm2_7i76e.0.7i73.0.1.input-08
net mpg-b encoder.0.phase-B <= hm2_7i76e.0.7i73.0.1.input-09

# The Axis select inputs
net mpg <= hm2_7i76e.0.7i73.0.1.input-03 ### This setting disables the MPG
net mpg-x axis.0.jog-enable <= hm2_7i76e.0.7i73.0.1.input-04
net mpg-y axis.1.jog-enable <= hm2_7i76e.0.7i73.0.1.input-05
net mpg-z axis.2.jog-enable <= hm2_7i76e.0.7i73.0.1.input-06

# The encoder output counts to the axis. Only the selected axis will move.
net encoder-counts <= encoder.0.counts
net encoder-counts => axis.0.jog-counts
net encoder-counts => axis.1.jog-counts
net encoder-counts => axis.2.jog-counts

# Activate MPG - ON flashing light in frontpanel
net mpglight-in1 <= hm2_7i76e.0.7i73.0.1.input-04 xor2.0.in0
net mpglight-in2 <= hm2_7i76e.0.7i73.0.1.input-05 xor2.0.in1
net next-out <= xor2.0.out
net mpglight-in3 <= hm2_7i76e.0.7i73.0.1.input-06 xor2.1.in0
net next-out xor2.1.in1
net mpglight-out <= xor2.1.out
net mpglight-out => hm2_7i76e.0.7i73.0.1.output-15
Last edit: 14 Sep 2017 17:01 by tecno. Reason: added text in subject

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

More
11 Sep 2017 15:48 - 11 Sep 2017 15:52 #98841 by PCW
Replied by PCW on topic 1 of 3 to output
It really doesn't make sense to use the software MPG component when
the 7I73 (and the 7I76E) have built in MPG counters (also you cannot use a base thread with the 7I76E)
Last edit: 11 Sep 2017 15:52 by PCW.

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

More
11 Sep 2017 15:52 #98842 by tecno
Replied by tecno on topic 1 of 3 to output
OK, can you please point me in the right direction = I am all ears.

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

More
11 Sep 2017 16:15 #98844 by PCW
Replied by PCW on topic 1 of 3 to output
did you check the available 7I73 hal pins?

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

More
11 Sep 2017 16:25 #98845 by tecno
Replied by tecno on topic 1 of 3 to output
It is setup for I/O + MPG

IN 0 to 6 for x1 x10 x100 and MPG off X Y Z
IN 8 and 9 A / B
Out 15 for indicator light MPG active


Following is in HAL but does not work so something missing?

### MPG increment selector

# --- JOG-INCR-A ---
net jog-incr-a <= hm2_7i76e.0.7i73.0.1.input-00

# --- JOG-INCR-B ---
net jog-incr-b <= hm2_7i76e.0.7i73.0.1.input-01

# --- JOG-INCR-C ---
net jog-incr-c <= hm2_7i76e.0.7i73.0.1.input-02


### MPG axis selector


# --- JOINT-SELECT-A ---
net joint-select-a <= hm2_7i76e.0.7i73.0.1.input-04

# --- JOINT-SELECT-B ---
net joint-select-b <= hm2_7i76e.0.7i73.0.1.input-05

# --- JOINT-SELECT-C ---
net joint-select-c <= hm2_7i76e.0.7i73.0.1.input-06

# ---jogwheel signals to mesa encoder - shared MPG---

net joint-selected-count <= hm2_7i76e.0.7i73.0.1.enc1.count

# ---mpg signals---

# for axis x MPG
setp axis.0.jog-vel-mode 0
net selected-jog-incr => axis.0.jog-scale
net joint-select-a => axis.0.jog-enable
net joint-selected-count => axis.0.jog-counts

# for axis y MPG
setp axis.1.jog-vel-mode 0
net selected-jog-incr => axis.1.jog-scale
net joint-select-b => axis.1.jog-enable
net joint-selected-count => axis.1.jog-counts

# for axis z MPG
setp axis.2.jog-vel-mode 0
net selected-jog-incr => axis.2.jog-scale
net joint-select-c => axis.2.jog-enable
net joint-selected-count => axis.2.jog-counts

# for axis a MPG
setp axis.3.jog-vel-mode 0
net selected-jog-incr => axis.3.jog-scale
net joint-select-d => axis.3.jog-enable
net joint-selected-count => axis.3.jog-counts

sets selected-jog-incr 0.000000

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

More
12 Sep 2017 05:12 #98860 by rodw
Replied by rodw on topic 1 of 3 to output
There are a couple of examples of using MPG's with the 7i76e in my Spaceship plasma build thread. You have my Hal file anyway.
It uses binary coded selectors to save on output pins.

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

More
12 Sep 2017 07:05 #98863 by tecno
Replied by tecno on topic 1 of 3 to output
Morning Rod,

7i73 is the board to be used as it is made for this purpose of remote MPG.

( got my spindle working = cigar ;) )

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

More
12 Sep 2017 10:26 - 12 Sep 2017 10:26 #98872 by rodw
Replied by rodw on topic 1 of 3 to output
Bengt, I don't think it will matter if you are using the 7i73. The pin names will change and that will be about it.

Here is my worked example of a single MPG wheel I set up complete with scale selector.

forum.linuxcnc.org/show-your-stuff/32029...utter-build?start=20

Seeing you have heaps of MPG encoders, I'd use one for each axis. They are not expensive.
Last edit: 12 Sep 2017 10:26 by rodw.

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

More
12 Sep 2017 10:33 #98874 by tecno
Replied by tecno on topic 1 of 3 to output
Heaps---- maybe but SPACE is very limited so I will stick to one encoder and rotating switches.

On the lathe build coming up I will have MPG's for each axis directly wired to 7i76e

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

More
12 Sep 2017 10:52 #98875 by rodw
Replied by rodw on topic 1 of 3 to output
I forgot to mention that the axis select is much the same way as the scale select
linuxcnc.org/docs/html/examples/mpg.html

I am also not sure the ilowpass is needed but you'll work it out

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

Time to create page: 0.174 seconds
Powered by Kunena Forum