Hello Guest it is December 03, 2020, 11:24:31 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - smurph

1
Mach4 General Discussion / Re: Mach 4 back up / Modus operandi
« on: December 03, 2020, 02:54:05 AM »
Adam,

They are in the stored in the Machine.ini that will be in your packaged profile.  So for all thing stock Mach, a profile package is a GREAT backup.  Now I can't say for certain where all data is stored for plugins that we didn't write.  But I would think most will use the Machine.ini file as well. 

Steve

2
Mach4 General Discussion / Re: LUA Problem with Jog Mode
« on: November 30, 2020, 02:13:54 PM »
mcJogSetType() works with mcJogGetType() so that scripts can use the API to coordinate jogging.  This is helpful for building control panels and such where a hardware jog button is connected to a physical input and a hardware switch is connected to multiple inputs.  Assume the following code is put in the screen load script:
Code: [Select]
function JogStart(mInst, axis, dir)
    local type = 0
    type, rc = mc.mcJogGetType(mInst, axis)
    if (rc == mc.MERROR_NOERROR) then
        if (type == mc.MC_JOG_TYPE_VEL) then -- velocity
            mc.mcJogVelocityStart(mInst, axis, dir)
        else                -- incremental
            local inc = 0
            inc, rc = mc.mcJogGetInc(mInst, axis)
            if (rc == mc.MERROR_NOERROR) then
                inc = inc * dir
                mc.mcJogIncStart(mInst, axis, inc)
            end
        end
    end
end

function JogStop(mInst, axis)
    local type = 0
    type, rc = mc.mcJogGetType(mInst, axis)
    if (rc == mc.MERROR_NOERROR) then
        if (type == mc.MC_JOG_TYPE_VEL) then -- velocity
            mc.mcJogVelocityStop(mInst, axis)
        end
    end
end

A call to mcJogSetType() will change the way the above functions work.  Also, a call to mcJogSetIncr() will change the increment used if the jog is an incremental jog. 

mcJogSetType() will also modify the following Mach registers, depending on the axis parameter:
core/inst/JogTypeX
core/inst/JogTypeY
core/inst/JogTypeZ
core/inst/JogTypeA
core/inst/JogTypeB
core/inst/JogTypeC

mcJogSetIncr() will also modify the following Mach registers, depending on the axis parameter:
core/inst/JogIncX
core/inst/JogIncY
core/inst/JogIncZ
core/inst/JogIncA
core/inst/JogIncB
core/inst/JogIncC

What these functions do not do is modify the jog types or increments that are used by the screen.  The screen maintains its' own jogging parameters.  These APIs were developed primarily for the PMC functionality or plugin development.  But they can be used by scripts in the manner shown above. 

Steve

3
Mach4 General Discussion / Re: Modbus Programming guidance needed
« on: November 30, 2020, 12:10:36 AM »
The Mach 4 MODBUS plugin just maps I/O or registers to the device.  That is basically ALL it does.  There really isn't any MODBUS "programming" as in some special MODBUS script.  The MODBUS plugin just maps Mach resources (registers and I/O) to the device.  Then you can use any LUA scripting as you would with any other Mach resources from any other plugin. 

I have no idea who wrote that scripting manual and why a MODBUS header was even included.  Maybe the author thought there was some MODBUS specific scripting, included the header, and then forgot to remove it after they found out there wasn't any MODBUS specific scripting?  I didn't write the scripting manual.  But I did write the MODBUS plugin so believe me when I tell you that there is no MODBUS specific scripting.  :)

In fact, you can do what you want with no scripting at all.

1. Setup the MODBUS plugin to have a function that writes to a holding (most likely) register.  (Function 6, write single register).  You will need to know the address of this register on your MODBUS device.  You will also have to give a name for the Mach register that will be mapped to this MODBUS function.  Writing a value of 123456 to this Mach register will use the Function 6 to write 123456 to the holding register you specified. 

2. Drop a DRO on the screen.  Then scroll to the "Register" property and find your MODBUS plugin register that you created. 

3. When you type a value in the DRO, your holding register will be updated. 

ALL Mach registers can be used in this manner.  The only thing different here is that there is a MODBUS device baking the register.

Now, if you want something more fancy that this, like preloading the register with a value, you will have to do some non MODBUS specific scripting that the scripting manual most likely covers (sections 3.2.1 and 4.3 look pertinent).

I believe the rest of the manual documents things VERY well.  I think that section 5.7 was left in there by mistake.  We all make mistakes. 

Steve

4
Mach4 General Discussion / Re: Modbus Programming guidance needed
« on: November 26, 2020, 04:56:34 PM »
Oh, there is a nice MODBUS PLC simulator that is a great learning/test tool. 

https://sourceforge.net/projects/modrssim2/

Steve

5
Mach4 General Discussion / Re: Modbus Programming guidance needed
« on: November 26, 2020, 04:52:34 PM »
MODBUS is going to be VERY device specific.  All of the device manufacturers use different terminologies and even give register information differently.  MODBUS, for the record, is always base 1 and decimal.  THAT is the standard.  But some device manufacturers give register information in base 0 and hex!!!  So yeah, it can be very confusing and there is no manual besides the ones from the manufacturers.  However, here is a nice writeup on the MODBUS protocol itself.  Having a good understanding of what MODBUS is supposed to be can help you untangle the mess of device documentation out there. 

https://www.modbusdriver.com/doc/libmbusmaster/modbus.html

The Mach 4 MODBUS plugin just maps I/O or registers to the device.  That is basically ALL it does.  There really isn't any MODBUS "programming" as in some special MODBUS script.  The MODBUS plugin just maps Mach resources (registers and I/O) to the device.  Then you can use any LUA scripting as you would with any other Mach resources from any other plugin. 

Steve


6
Those switches will work fine.  The roller switches are usually used in with ramps.  Nice build, BTW.  :) 

5 limit switches and 3 home switches.  There usually isn't a lower limit switch on the Z axis because when the spindle has a tool inserted, it can't reach the lower limit anyway without drilling into the table. 

On machine tools, the limits are usually wired as normally closed and the ESS limits are setup to be active low.  That way if the limit switch wire is damaged, the machine stops. 

E-Stop is usually wired into the power circuit that runs the drives/motors.  Without power, motors will stop!  So hitting the e-stop button should interrupt/cut the power to the drives/motors.  The power circuit might also include a relay allows the ESS to monitor the circuit.  That way both ESS and Mach may be updated as to the state of the e-stop button (ISIG_EMERGENCY in the mach signals).

Steve

7
Mach4 General Discussion / Re: MACH4 4th axis Limit switch
« on: November 14, 2020, 02:49:33 AM »
Mach may see the homing signal light up, but it does absolutely nothing with it.  Homing is the responsibility of the motion controller itself.  If the switch isn't also being used as a limit, maybe the motion controller is seeing the home switch light up and stopping movement?  If so, maybe you need to talk to the motion controller manufacturer. 

Steve

8
Mach4 General Discussion / Re: Jogging Really Rough With New MPG Pendant
« on: November 14, 2020, 02:27:04 AM »
Hmm...  My screen set works as expected regarding the incremental vs. continuous.  The label changes from continuous to incremental and the increment size enable/disables.  Maybe your screen set has been modified? 

What screen set are you using?  What build did you install? 

Steve

9
Mach4 General Discussion / Re: macro for Home Axis
« on: November 14, 2020, 02:06:00 AM »
Why do you need a script?  Just place a button on the screen, click on it, then find the event button on the properties window (it has a little lightening bolt) then select the "Home C" action on the left up action.  The button will only work when the machine is NOT in automatic mode (meaning idle and not in a cycle).  So be sure to set the "Enable With Machine" and the proper "Enabled States".

Steve

10
First off, the CV wizard is really intended to control CV based off of angles.  It is mainly only needed for 2.5D work on machines that are about as rigid as a wet noodle and the programmer is too lazy for program realistic speeds for it.  :)  If you are doing 3D work or very granular G code, then you probably do not need the CV wizard at all.  Blow the CV section out of the Machine.ini of the profile or create another profile and don't run the CV wizard. 

Next, CV is really a misnomer, IMHO.  It is really VB (Velocity Blending).  Thus CV is wholly dependent on your motor acceleration parameters.   The higher the acceleration parameters you can use, the better CV will hold to the actual path.  So run your accel parameters up until the steppers start screaming and losing steps and then back it down.  It may just have really soft acceleration parameters even though it was professionally configured. 

And also check your look ahead buffer.  Pop it up to 200 or so from the default 20 and see if that helps. 

For me, my 3D profiling stuff is silky smooth.  But I'm using a Mach4/Galil with analog DC servos that have torque that allows for insane acceleration parameters.  And it absolutely chews through very granular G code. 

Steve