584,800 active members*
4,747 visitors online*
Register for free
Login
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2016
    Posts
    20

    LinuxCNC + Mpg help please

    Hi I am retrofit denford orac to linuxcnc/mach3. I have got mach3 fully working but I cannot handle linuxcnc. I am trying to add mpg into but I have some strange issue with it.
    I have wrote the code and place it into custom.hal. Seems like mpg works but only one direction doesn't matter with way I am turning (If I am using arrows work great). I have windows xp with mach3 installed on another partition and the same mpg works great too. Can any one have a look in my code is there anything wrong with it
    My code:
    "
    loadrt select8 count=1
    loadrt updown count=1
    addf select8.0 servo-thread
    addf updown.0 servo-thread
    net encA encoder.1.phase-A <= parport.1.pin-12-in
    net encB encoder.1.phase-B <= parport.1.pin-11-in
    net enc-counts encoder.1.counts => axis.0.jog-counts axis.1.jog-counts
    net jog-button updown.0.countup <= parport.0.pin-15-in
    net jog-choice updown.0.count => select8.0.sel
    net jogX axis.0.jog-enable <= select8.0.out0
    net jogY axis.1.jog-enable <= select8.0.out1
    setp encoder.1.counter-mode 1
    setp updown.0.max 1
    setp updown.0.min 0
    setp updown.0.wrap 1
    setp axis.0.jog-scale 0.1
    setp axis.1.jog-scale 0.1
    "


  2. #2
    Join Date
    Feb 2008
    Posts
    644

    Re: LinuxCNC + Mpg help please

    Quote Originally Posted by lolos View Post
    Hi I am retrofit denford orac to linuxcnc/mach3. I have got mach3 fully working but I cannot handle linuxcnc. I am trying to add mpg into but I have some strange issue with it.
    I have wrote the code and place it into custom.hal. Seems like mpg works but only one direction doesn't matter with way I am turning (If I am using arrows work great). I have windows xp with mach3 installed on another partition and the same mpg works great too. Can any one have a look in my code is there anything wrong with it
    My code:
    "
    loadrt select8 count=1
    loadrt updown count=1
    addf select8.0 servo-thread
    addf updown.0 servo-thread
    net encA encoder.1.phase-A <= parport.1.pin-12-in
    net encB encoder.1.phase-B <= parport.1.pin-11-in
    net enc-counts encoder.1.counts => axis.0.jog-counts axis.1.jog-counts
    net jog-button updown.0.countup <= parport.0.pin-15-in
    net jog-choice updown.0.count => select8.0.sel
    net jogX axis.0.jog-enable <= select8.0.out0
    net jogY axis.1.jog-enable <= select8.0.out1
    setp encoder.1.counter-mode 1
    setp updown.0.max 1
    setp updown.0.min 0
    setp updown.0.wrap 1
    setp axis.0.jog-scale 0.1
    setp axis.1.jog-scale 0.1
    "

    You have the encoder mode set wrong:

    setp encoder.1.counter-mode 1

    This should be

    setp encoder.1.counter-mode 0
    or better
    setp encoder.1.counter-mode false

    From the encoder component manual page:

    PINS
    encoder.N.counter-mode bit i/o
    Enables counter mode. When true, the counter counts each rising
    edge of the phase-A input, ignoring the value on phase-B. This
    is useful for counting the output of a single channel (non-quadrature)
    sensor. When false (the default), it counts in quadrature mode.

  3. #3
    Join Date
    Mar 2016
    Posts
    20

    Re: LinuxCNC + Mpg help please

    Great You are a star thanks - works!!!! I have to play with ilowpass now.
    I have got one more question
    - Can I use 2 different mpg's for X and Z
    cheers

  4. #4
    Join Date
    Feb 2008
    Posts
    644

    Re: LinuxCNC + Mpg help please

    Quote Originally Posted by lolos View Post
    Great You are a star thanks - works!!!! I have to play with ilowpass now.
    I have got one more question
    - Can I use 2 different mpg's for X and Z
    cheers
    Sure, you would need to add another encoder instance (and 2 free input pins for the second MPG encoder)
    Since the jog keys still need the per axis selection but the MPGs do not, you would need to change the per axis
    jog enable logic to allow simultaneous X/Z jogging via the MPGs

  5. #5
    Join Date
    Mar 2016
    Posts
    20

    Re: LinuxCNC + Mpg help please

    If I go for it ...is that code correct then?
    "

    net encA encoder.1.phase-A <= parport.1.pin-12-in
    net encB encoder.1.phase-B <= parport.1.pin-11-in
    net enc-counts encoder.1.counts => axis.0.jog-counts

    net encA encoder.2.phase-A <= parport.1.pin-13-in
    net encB encoder.2.phase-B <= parport.1.pin-15-in
    net enc-counts encoder.2.counts => axis.1.jog-counts

    net jogX axis.0.jog-enable
    net jogY axis.1.jog-enable

    setp encoder.1.counter-mode 0


    setp axis.0.jog-scale 0.1
    setp axis.1.jog-scale 0.1
    "

  6. #6
    Join Date
    Mar 2016
    Posts
    20

    Re: LinuxCNC + Mpg help please

    doesn't work

Similar Threads

  1. LinuxCNC 2.7.3 G0 Z0
    By GeeB in forum LinuxCNC (formerly EMC2)
    Replies: 1
    Last Post: 03-27-2016, 01:10 PM
  2. LinuxCNC 2.7.1
    By kstrauss in forum Tormach PathPilot™
    Replies: 2
    Last Post: 10-18-2015, 08:21 PM
  3. LinuxCNC?
    By MBViklund in forum Novakon
    Replies: 79
    Last Post: 01-29-2015, 06:33 AM
  4. Linuxcnc 2.5.2 won't run
    By cpeter in forum LinuxCNC (formerly EMC2)
    Replies: 18
    Last Post: 04-24-2014, 12:54 PM
  5. LinuxCNC right for me?
    By punisher454 in forum LinuxCNC (formerly EMC2)
    Replies: 10
    Last Post: 06-18-2012, 04:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •