Hello Guest it is May 17, 2024, 02:14:48 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 - Brian Barker

371
Mach4 General Discussion / Re: G28,M47 broke ?
« on: May 07, 2014, 11:43:35 AM »
I call them what you like but the  #var and #param  are stored in registers.. they are all the same sort of.

Thanks
Brian

372
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 07, 2014, 11:39:35 AM »
OK Thanks everyone.  :-*  I have a few nuggets to chew on now.

O gosh... What flavor? I if they are brown with yellow spots, if so I can help you. Don't use them and DON'T chew them!

373
Mach4 General Discussion / Re: G28,M47 broke ?
« on: May 07, 2014, 11:25:33 AM »
I have a plugin here that will report the # vars. It has been added to the Reg plugin. It will be in the next release
Thanks
Brian

374
Mach4 General Discussion / Re: Lua Lua Lua Louieeeeeee
« on: May 07, 2014, 11:23:07 AM »
And so it is, One more example is the dead machine scrolls ... I will put them in a cave so no one can find them!

375
Please will someone say it.. WxLua was the correct scripting environment! Look at what has been done and we have done NO docs so far...  I can't wait to see where this goes...

After all the bitching about it not being VB, This is way better then VB LOL
Thanks
Brian

376
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 07, 2014, 11:16:56 AM »
The name is what you would like to name the register.. In Mach4 you refer to the registers by name not by number!

The rest of it is:
Slave ID
Register (we have all the tables so sometimes you need to drop the first number.. for example I am working on a Mitsubishi drive now and I had to remove the 40000 because we know it should be in table 4.

Here are some examples of how I read and write:

Function from my RB1 to jog the head up by setting the HeadJogDir and HeadJogOn:
Code: [Select]
function HeadUp()
    local inst= mc.mcGetInstance();
    --Get the hReg handle of the modbus analog register
    local HeadUp = mc.mcRegGetHandle(inst, "modbus0/HeadJogDir");
    local HeadOn = mc.mcRegGetHandle(inst, "modbus0/HeadJogOn");

    if (HeadUp ~= 0 and HeadOn ~= 0) then
        mc.mcRegSetValue(HeadUp, 0);
        mc.mcRegSetValue(HeadOn, 1);
    end
end

Reading the Hz from the inverter from the Hz register:
Code: [Select]
   local inst= mc.mcGetInstance();
    local Hz = 0;
    local HzReg = mc.mcRegGetHandle(inst, "modbus0/Hz");
    if (HzReg ~= 0) then
      Hz =  mc.mcRegGetValue(HzReg);
    end

You can also set it to be an input or an output on a register.. The register types are important.. you need to select the correct type (this is a modbus standard)
Hope that helps..
Brian

377
Mach4 General Discussion / Re: G28,M47 broke ?
« on: May 07, 2014, 12:16:21 AM »
Yeah I can see that I forgot the # But you got the idea

Not at this time..

378
Mach4 General Discussion / Re: Mach 4 Feature Request
« on: May 07, 2014, 12:14:26 AM »
You can do that in the PLC script. The screen editor is your friend

379
Mach4 General Discussion / Re: Lua Lua Lua Louieeeeeee
« on: May 06, 2014, 11:19:55 PM »

Here is a snip of a tool changer so you can see how I formatted the strings
Code: [Select]
--Drop off the current tool
        local code = "G0 G53 Z0.0\n"
        code = code .. string.format("G0 G53 X%.4f Y%.4f\n", m_changePos[CurrentTool].x + m_X_Pullout, m_changePos[CurrentTool].y + m_Y_Pullout)
        code = code .. string.format("G0 G53 Z%.4f\n", m_ZtoolHeight)
        code = code .. string.format("G0 G53 X%.4f Y%.4f\n", m_changePos[CurrentTool].x, m_changePos[CurrentTool].y)
        mc.mcCntlGcodeExecute(inst, tostring(code))

        --Release tool
        mc.mcSignalSetState(unclamp, true);--Unclamp
        wx.wxSleep(.75)

        --Move to new tool
        code = string.format("G0 G53 Z%.4f\n", m_ZtoolHeight + m_PullupDist)
        code = code .. string.format("G0 G53 X%.4f Y%.4f", m_changePos[NewTool].x, m_changePos[NewTool].y)
        code = code .. string.format("G0 G53 Z%.4f", m_ZtoolHeight)
        mc.mcCntlGcodeExecute(inst, tostring(code))

        --Clamp tool
        mc.mcSignalSetState(unclamp, false);--Unclamp
        wx.wxSleep(.75)
        mc.mcToolSetCurrent(inst, NewTool)

        code = string.format("G0 G53 X%.4f Y%.4f", m_changePos[NewTool].x + m_X_Pullout, m_changePos[NewTool].y + m_Y_Pullout)
        code = code .. string.format("G0 G53 Z0.0")
        mc.mcCntlGcodeExecute(inst, tostring(code))


I am going to wait for the sun and look for dust...

380
Mach4 General Discussion / Re: G28,M47 broke ?
« on: May 06, 2014, 11:11:57 PM »
Sorry, we are going to stick with the standard way point convention. I know it is odd but it is what we have all lived with for years.

Now if you would like to move to a position of the G30 you could look up the registers and do a g53.

G0 g90 G53 X[5181] Y[5182] Z[5183]

Not tested but it should work..  I use G53 because I hate G28 / G30