Need Help! X/Y probing macro - G31 code trouble


Results 1 to 9 of 9

Thread: X/Y probing macro - G31 code trouble

  1. #1
    Member
    Join Date
    Jun 2012
    Location
    US
    Posts
    74
    Downloads
    4
    Uploads
    0

    Default X/Y probing macro - G31 code trouble

    Hello,

    I am new to Mach3, been only a couple months playing with it.
    My machine is setup in brief as;

    Win7 x64 PC with Mach3 3.043.066, which I believe is the latest.
    Chinese USB 6-Axis breakout board
    Leadshine Easy-servo stepper system

    What I am going to do is to put an aluminium block on my cutting Jig and to use this piece to let machine know where machining origin is located.

    Z-probe is working fine. There is no wonder about it.
    The below macro was provided and I am using this happily.
    Very simple, yet effective and I understand what it does.

    ------------------------------------------------
    'chengdu xhc tec. probe z surface macro
    FeedCurrent = GetOemDRO(818) 'Get the current settings, OEM DROs (818)=Feedrate DRO
    ZCurrent = GetOemDro(802) 'OEM DROs (802)=Z DRO
    GageH = GetOEMDRO(1001) 'OEMDRO(1001)=Gage Block Height
    ZNew = ZCurrent - 300 'probe down
    Code "G90F200" 'slow feed rate to 200 MM/MIN
    SetOemDRO(818,200)
    Rem Code "G4 P1" 'Pause 1 second to give time to position probe plate
    Code "G31 Z" &ZNew
    While IsMoving()
    Sleep(10)
    Wend
    Call SetDro (2,GageH) 'DRO(2)=Z DRO

    FinalMove = GageH + 10
    Code "G0 Z" &FinalMove
    Code "F" &FeedCurrent 'restore starting feed rate
    SetOemDRO(818,FeedCurrent)
    ------------------------------------------------------------------------------------------

    I wanted to do the same thing for X & Y.
    Firstly, I tried Hoss screenset, which is for free (thanks), it still does not MOVE or it moves weirdly.
    Where G31 command is involved, I expected F100(or 200 as in the script) moving, but it just does not move or move rapidly-stop-rapidly-stop-etc.
    To my eyes it apparently is related to G31 command in the scripts.
    And then I tried modifying Hoss's scrip very similar to the above one, also failed.
    Replaced all Z parameter with X or Y, and replaced GageH with probe diameter(OemDRO(43) for HOSS screenset), all failed.
    Whenever G31 is involved, It just is not moving its gantry.

    So, I decided to buy a 2010 screenset (which is not free sadly), actually bought it yesterday,
    and the result is very disappointing.

    Either it moves weirdly or it gives error messages'Compile script error In:'.

    Where do you think is the trouble from?
    Is there any simple command to check?
    Will there be any possibllity that my macro library lacks certain specific and critical files or codes?

    I tried 'G31 x -50', it alone works sometimes but I can't find the condition when it doesn't work.
    Wireless remote pendant works good, keyboard jogging good, mouse-jogging good, z-probing good,
    EXCEPT x or y probing where G31 comand is involved.

    I spent 2 days to figure it out, tried reading many references, looked into macros that were included in 2010 screenset & Hoss set, nothing works and I am at my wits end.
    Will there be anybody who can throw me a light please?

    Thanks for reading,

    Kevin

    Similar Threads:


  2. #2
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: X/Y probing macro - G31 code trouble

    My guess is that the plugin for your USB board does not properly support X and Y probing using G31.
    This is common on some of the chinese motion controllers.
    You might want to try contacting the manufacturer and see if they have an updated plugin, or can fix the issue.

    If you're not going to use my screenset, send me an email and I'll refund the purchase price.

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  3. #3
    Member
    Join Date
    Jun 2012
    Location
    US
    Posts
    74
    Downloads
    4
    Uploads
    0

    Default Re: X/Y probing macro - G31 code trouble

    Hi Gerry,

    Thanks for the tip.
    There was a major progress here.
    I searched if there is any updated .dll file for this card, found several.
    I tried all of them, and finally I am using v2.34.1 which is found here;

    http://www.cdxhctech.com/html/Driver/ <-- all of their .rar files include pirated Mach3 in it, that's why file size is so big.....

    With this updated driver, I can use Hoss's probing tool for X- , Y+ and Z-.
    (X+ & Y- still does not work, alas..)

    At least I can design my jig using these two buttons, and I am going to disable all other buttons to prevent accidental usage.

    I know nothing of <inside macros and codes >how they work.
    But I assume G31 is very different from G0, G1 or something else.

    Though situation is not fully resolved, partial resolving still helps me to live with it.

    And thanks for your consideration Gerry, so grateful.
    I might stick to Hoss's version and I will drop you a mail regarding screenset I purchased.

    regards,
    Kevin



  4. #4
    Registered
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    47
    Downloads
    0
    Uploads
    0

    Default Re: X/Y probing macro - G31 code trouble

    Go to the renishaw website. There is a lot of info there.



  5. #5
    Member
    Join Date
    Jun 2012
    Location
    US
    Posts
    74
    Downloads
    4
    Uploads
    0

    Default Attached - New driver file for XHC Mach3 USB Motion Card

    I sent a mail to the manufacturer of this board and surprisingly they responded in an hour.
    The gentleman replied to me sent a new plug-in file for this USB motion control board.
    From the date and time of this file, I strongly believe he debugged and re-compiled this file for me in an hour.

    Final summary - or close to it

    My board is this one, which was equipped from the factory.

    X/Y probing macro - G31 code trouble-_12-jpg

    And this G31 issue was from the driver file, not from hardware or screenset.

    The file I got at first from this gentleman was V2.34.6 which was not an improvement,
    I replied the result and got another version v2.34.7 which worked on all direction for G31 command. Excellent!!!
    Only one thing bugging me was that probing feed had a little glitch it didn't work under F210, F210 was minnimum required rate to run G31.

    I gave him this info and got another version, v2.34.8 which is attached here but it still does not show any difference for this matter.
    A'way, this driver works for all direction when using G31 at feedrate more than F210.
    I gave another test result to him just ago and wish they will settle this issue permanently.
    Until they send me a new file, you can use the attached at F210 or higher, like F250 temporarily.

    regards,
    Kevin

    ps. I got their permission to post this driver file here.

    ps2. Just got a new answer that my board is a little bit older one(revision 2.8) so that feed rate is not usable with mine.
    Current version 3.1 board would work he said, FYI.

    Attached Files Attached Files
    Last edited by Lozzy; 10-13-2014 at 12:17 AM. Reason: correction/addition


  6. #6
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: X/Y probing macro - G31 code trouble

    Good to know that they'll fix any bugs that you find.

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  7. #7
    Member
    Join Date
    Jun 2012
    Location
    US
    Posts
    74
    Downloads
    4
    Uploads
    0

    Default Re: X/Y probing macro - G31 code trouble

    Hi Gerry,

    I really appreciate your advice and help. Also with paypal!!
    I have to add one more thing in this thread.

    While I was playing happily with G31 command scripts, I found that at certain point gantry moved at unwanted direction and distance.
    I have looked into the matter for hours experimenting this and that and I think I found the cause of trouble.

    Whenever G90/G91 mode change is called, this erratic behavior happens and I assume there should be certain TIME this value is written or registered.
    So I put G4 P0.5 after every G90/91 change, it works fine.

    I have no knowledge of insight coding and I don't know minimum required delay for modal change.
    If anybody knows this, it would be greatly helpful.

    regards,
    Kevin



  8. #8
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: X/Y probing macro - G31 code trouble

    I don't think that there is a fixed minimum time needed. When writing macros for Mach3, if you send a Code command that doesn't have movement, or write to DRO's, add a Sleep(250) after them (1/4 second delay). This should make sure that ne commands are "skipped".
    When a "Code" command with movement is issued, make sure you have a While...IsMoving after it.

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  9. #9
    Member
    Join Date
    Jun 2012
    Location
    US
    Posts
    74
    Downloads
    4
    Uploads
    0

    Default Re: X/Y probing macro - G31 code trouble

    Invaluable tips Gerry.

    I modified my scripts as belows, everything works fine,
    it returns G90/G91 status correctly, no more mess - had broken endmill 3 times...
    I applied this to all directions, replacing X+/X-/Y+/Y-.

    Many thanks!

    Kevin

    =========================================

    Rem VBScript For probing In the x+ direction With tool diameter Input Metric Version


    CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
    CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
    CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
    CurrentToolDiameter = GetOemDRO(43) 'gets the current tool diameter
    CurrentToolRadius = CurrentToolDiameter/2
    CurrentX=GetDro(0)
    RetractDistance=CurrentToolRadius+10

    If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
    Call ProbeGrounded()
    Exit Sub
    Else
    Code "G90F150"
    Sleep(10)
    SetOemDRO(818,150)
    Sleep(10)
    Code "G31 X" &(CurrentX+40)
    While IsMoving() 'wait for prob move to complete
    Sleep(10)
    Wend
    Call SetDro (0,CurrentToolRadius)
    Sleep(100)
    Code "G0 X-" &(RetractDistance)
    While IsMoving()
    Sleep(10)
    Wend
    Code "F" &CurrentFeed 'restore original feed rate
    Sleep(10)
    SetOemDRO(818,CurrentFeed)
    Sleep(10)
    Call ReturnG90G91State()
    Sleep(10)
    Exit Sub

    End If

    Sub ProbeGrounded()
    Code "(Probe plate is grounded, check connection and try again)"
    End Sub

    Sub ReturnG90G91State()
    If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
    Code "G91"
    End If
    If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
    Code "G0"
    End If
    End Sub



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

X/Y probing macro - G31 code trouble

X/Y probing macro - G31 code trouble