Page 1 of 2 12 LastLast
Results 1 to 12 of 15

Thread: Modbus to run GS-2 drive?

  1. #1
    Registered
    Join Date
    Oct 2005
    Location
    USA
    Posts
    77
    Downloads
    0
    Uploads
    0

    Modbus to run GS-2 drive?

    I see that Mach 3 has Modbus capabilities. Does anyone know how difficult it would be to interface a PC running Mach 3 with an Automation Direct GS-2 drive using the modbus protocol over RS-232 or 485? I was originally looking to use another CNC controller program (CNC Zeus) mainly because it was capable of directly controlling my spindle without additional hardware, but I have not been thrilled with the performance, and Mach 3 looks like it might work well, provided I can control my spindle with it.


  2. #2
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Twp, MI....USA
    Posts
    22,300
    Downloads
    0
    Uploads
    0
    Hopefully Peter will see this and have an answer for you. He makes the ModIO board. http://www.homanndesigns.com/ModIO.html

    If you look at the ModIO user manual, it has some info on setting up Modbus devices that might help you out.
    Gerry

    Mach3 2010 Screenset
    http://home.comcast.net/~cncwoodworker/2010.html

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


  3. #3
    Registered phomann's Avatar
    Join Date
    Aug 2005
    Location
    Australia
    Posts
    586
    Downloads
    0
    Uploads
    0
    Yes, Mach3 can control MOdbus devices including the ModIO http://www.homanndesigns.com/ModIO.html

    Mach will drive the GS-2 directly although I haven't done it. I use the DigiSpeed http://www.homanndesigns.com/DigiSpeedDeal.htmlto drive my motor controller.

    Cheers,

    Peter.


    Quote Originally Posted by mecheng10 View Post
    I see that Mach 3 has Modbus capabilities. Does anyone know how difficult it would be to interface a PC running Mach 3 with an Automation Direct GS-2 drive using the modbus protocol over RS-232 or 485? I was originally looking to use another CNC controller program (CNC Zeus) mainly because it was capable of directly controlling my spindle without additional hardware, but I have not been thrilled with the performance, and Mach 3 looks like it might work well, provided I can control my spindle with it.
    -------------------------------------------------
    Homann Designs - http://www.homanndesigns.com/store


  4. #4
    Registered
    Join Date
    Oct 2005
    Location
    USA
    Posts
    77
    Downloads
    0
    Uploads
    0

    How to implement modbus for VFD

    Another question here: Suppose I want to communicate directly between my host pc running Mach 3 and my VFD (Automation Direct GS-2) using Modbus. How do I go about doing it? I have looked at the Modbus control setup in Mach 3 and I don't understand how to set it up for direct communication with such a device. An example of what I would like to do it is as follows:

    -Use Mach 3 to communicate directly with a GS-2 drive using the a serial port on the host pc and the RJ-12 port on the drive as well as a custom cable
    -Communicate using RS-232C or RS 485 (preferred if possible due to EMI immunity)
    -Whenever Mach 3 encounters a M03 command in a running program
    ---write 0001 hex to address 091B hex on GS-2 drive
    ---write 0000 hex to address 091C hex on GS-2 drive
    ---read 091B and 091B hex from GS-2 drive
    ---if values not correct, resend
    -Whenever Mach 3 encounters a M04 command in a running program
    ---write 0001 hex to address 091B hex on GS-2 drive
    ---write 0001 hex to address 091C hex on GS-2 drive
    ---read 091B and 091B hex from GS-2 drive
    ---if values not correct, resend
    -Whenever Mach 3 encounters a M05 command in a running program
    ---write 0000 hex to address 091B hex on GS-2 drive
    ---read 091B hex from GS-2 drive
    ---if value not correct, resend
    -Whenever Mach 3 encounters a S____ command in a running program
    ---convert S command to desired drive output frequency
    ---write ____ to address 091A hex on GS-2 drive
    ---read 091A hex from GS-2 drive
    ---if value not correct, resend

    I would like to extend this general concept to include reading and resetting drive errors from Mach 3 as well as triggering external faults on the drive in the event of an e-stop etc.

    My real question hear is: Does MAch 3 have the capabilities to due this type of thing? Would I have to write my own code to do this?

    Thanks,
    -Brian


  • #5
    Registered
    Join Date
    Oct 2004
    Location
    US
    Posts
    118
    Downloads
    0
    Uploads
    0
    You would have to setup the registers in decimal and enable bitpacking... Should be no probelm and if you start on that project please feel free to mail me and i will help you with the settings

    Thanks
    Brian


  • #6
    Registered
    Join Date
    Oct 2005
    Location
    USA
    Posts
    77
    Downloads
    0
    Uploads
    0

    programming modbus spindle control

    I am just becoming familiar with how Mach works. Here is what I have determined so far. Please correct me if I'm wrong.

    -Control of the spindle through Modbus can be accomplished by writing VB script that can be activated by a button that could be added to the user interface using a screen designer or that could be caled from within the G-code. Is there a way to automatically activate such a script when starting Mach?

    -Communication with the spindle device can be accomplished through modbus by using the built in direct or polled modbus communication functions such as FillFromInput and GetInput within the script.

    Am I on the right track here?

    -Brian


  • #7
    Registered
    Join Date
    Oct 2004
    Location
    US
    Posts
    118
    Downloads
    0
    Uploads
    0
    You are close but here is no VB that needs to be done and there is no need to work on the screen All you have to do is setup the bitpacking and set the register that you need to send the word for the velocity. I have the manual for the drive here and I have one inthe mill in the shop... just need time to get out there and get it working


  • #8
    Registered
    Join Date
    Oct 2005
    Location
    USA
    Posts
    77
    Downloads
    0
    Uploads
    0

    Modbus settings

    Barker,

    Not having to write any code sounds great! I'm a little rusty. Not sure I understand how the S word get translated into the correct frequency command, and send over Modbus without code though. To me it looks like the standard version of Mach only supports spindle speed control using step and direction signals, and PWM. Under config/ports and pins, I see Modbus spindle. Is that the right thing to use. It appears that is supposed to work with 3rd party breakout boards. Would you be willing to post the needed setting? I think I understand the GS-2 side of things ok, but not the Mach 3 side of things very well.


    Many thanks,
    -Brian


  • #9
    Registered
    Join Date
    Oct 2004
    Location
    US
    Posts
    118
    Downloads
    0
    Uploads
    0
    Yup, no problem tell me the register in Decimal and what bit you need changed. the settings on the mach3 side will only take me a few min


  • #10
    Registered
    Join Date
    Oct 2005
    Location
    USA
    Posts
    77
    Downloads
    0
    Uploads
    0

    Decimal Addresses

    If my hex to decimal conversion is correct, this should be what I need to do:

    -Whenever Mach 3 encounters a M03 command in a running program
    ---write 1 to address 2331 on GS-2 drive
    ---write 0 to address 2332 on GS-2 drive
    ---read 2331 and 2332 from GS-2 drive
    ---if values not correct, resend
    -Whenever Mach 3 encounters a M04 command in a running program
    ---write 1 to address 2331 on GS-2 drive
    ---write 1 to address 2332 on GS-2 drive
    ---read 2331 and 2332 from GS-2 drive
    ---if values not correct, resend
    -Whenever Mach 3 encounters a M05 command in a running program
    ---write 0 to address 2331 on GS-2 drive
    ---read 2331 from GS-2 drive
    ---if value not correct, resend
    -Whenever Mach 3 encounters a S____ command in a running program
    ---convert S command to desired drive output frequency
    ---write ____ to address 2330 on GS-2 drive
    ---read 2330 hex from GS-2 drive
    ---if value not correct, resend


    -Brian


  • #11
    Registered
    Join Date
    Oct 2004
    Location
    US
    Posts
    118
    Downloads
    0
    Uploads
    0
    Here are the Macro's that you will need to change:

    M3

    Call Setmodoutput(1,1) 'Turn on the spindle
    Call Setmodoutput(2,0) 'This tells the spindle to turn CW
    DoSpinCW()


    M4

    Call Setmodoutput(1,1) 'Turn on the spindle
    Call Setmodoutput(2,1) 'This tells the spindle to turn CCW
    DoSpinCCW()

    M5

    Call Setmodoutput(1,0) 'Turn on the spindle
    Call Setmodoutput(2,0) 'This tells the spindle to turn CW
    DoSpinStop()

    And you can see the settings in the pic...

    Hope that helps
    Brian
    Attached Thumbnails Attached Thumbnails Modbus to run GS-2 drive?-gs2_settings.jpg  


  • #12
    Registered
    Join Date
    Oct 2005
    Location
    USA
    Posts
    77
    Downloads
    0
    Uploads
    0

    Macro code

    Barker,

    This seems much simpler than I originaly thought. I do have a couple of issues though. Please see my comments below.


    M3

    Call Setmodoutput(1,1) 'Turn on the spindle
    Call Setmodoutput(2,0) 'This tells the spindle to turn CW
    DoSpinCW()


    M4

    Call Setmodoutput(1,1) 'Turn on the spindle
    Call Setmodoutput(2,1) 'This tells the spindle to turn CCW
    DoSpinCCW()

    M5

    Call Setmodoutput(1,0) 'Turn on the spindle
    Call Setmodoutput(2,0) 'This tells the spindle to turn CW
    DoSpinStop()

    It appears that buffIndex starts counting with 0, so shouldn't the 1s be 0s and the 2s be 1s?

    Also, to set the spindle speed given the settings you gave, could I modify the spindlespeed macro to something like this:

    spindlespeed

    rpm = GetRPM()
    SetSpinSpeed( rpm )
    ratio = ??? 'Determines ratio of motor output frequency to spindle speed
    freq = rpm/ratio 'Calculates desired output frequency given ratio
    Call Setmodoutput(64,freq) 'Set drive output frequncy to desired value


    -Brian


  • Page 1 of 2 12 LastLast

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.