LinuxCNC + Mpg help please


Results 1 to 6 of 6

Thread: LinuxCNC + Mpg help please

  1. #1
    Member
    Join Date
    Mar 2016
    Location
    United Kingdom
    Posts
    20
    Downloads
    0
    Uploads
    0

    Default 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
    "



    Similar Threads:


  2. #2
    Member
    Join Date
    Feb 2008
    Location
    USA
    Posts
    644
    Downloads
    0
    Uploads
    0

    Default 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.

    Last edited by PCW_MESA; 07-01-2018 at 04:33 PM. Reason: fix broken line breaks in manual page


  3. #3
    Member
    Join Date
    Mar 2016
    Location
    United Kingdom
    Posts
    20
    Downloads
    0
    Uploads
    0

    Default 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
    Member
    Join Date
    Feb 2008
    Location
    USA
    Posts
    644
    Downloads
    0
    Uploads
    0

    Default 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
    Member
    Join Date
    Mar 2016
    Location
    United Kingdom
    Posts
    20
    Downloads
    0
    Uploads
    0

    Default 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
    Member
    Join Date
    Mar 2016
    Location
    United Kingdom
    Posts
    20
    Downloads
    0
    Uploads
    0

    Default Re: LinuxCNC + Mpg help please

    doesn't work



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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

LinuxCNC + Mpg help please

LinuxCNC + Mpg help please