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

311
Mach4 General Discussion / Re: Preload-Tool Macro
« on: February 25, 2017, 04:07:27 PM »
No modbus on that thing at all.  I see where someone is working on Modbus integration, but nothing more.  I'm not sure how one would communicate with that PLC at all at the moment.  I can assure you, there will be NO threads about how to hook Mach 4 to that one.  So you are own you own.  Nothing like being the first to try and do something!!  :)

We do have serial comms via LUA.  http://lua-users.org/lists/lua-l/2012-09/msg00554.html  That may be what you have to do.  

For the price (in fact, cheaper), the Automation Direct Click PLCs are comparable and a LOT more powerful.  Stackable.  Need more I/O in the future, no problem.  https://www.automationdirect.com/adc/Shopping/Catalog/Programmable_Controllers/CLICK_Series_PLCs_(Stackable_Micro_Brick)/PLC_Units

Steve

312
That would be on the motor tuning page.  The velocity setting.  That will be the maximum velocity that the motor will do.  e.g. your rapid velocity.  The jog rate can then be set as a percentage of this max velocity.

Steve

313
Mach4 General Discussion / Re: Lua Macro Parameters
« on: February 24, 2017, 06:13:32 PM »
It is hard to simulate a macro with parameters because hParam is a handle to the parameters which just does not exists in the editor environment.  What I do is just set the variable to what you want to test with and ignore the parameter retrieval stuff while developing.  e.g. Set endX to a value and start debugging. 

Code: [Select]
--Reel Seat Insert
--Turn from current Z down to 0 from current X down to parameter D or .850

function m6690(hParam)
  local xNow,zNow,maxVal
  local TS,TR,TT --timer values Mach3 niy
  local plungeFeed=6
  local roughDOC=0.015
  local roughFeed=15
  local roughSpeed=900
  local finishDOC=0.004
  local finishFeed=8
  local finishSpeed=1400
  local inst=mc.mcGetInstance()
  local endX=.850 --param1()
 
  local inst=mc.mcGetInstance()

  mc.mcCntlSetLastError(inst,'')

  if (mc.mcInEditor() == 1) then
    endX = .850 --param1()
  else
    if (hParam ~= nil) then
      local DFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_D)
      if(DFlag == 1) then
        endX = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_D)
      end
    end
  end
  xNow = mc.mcAxisGetPos(inst,0)
  zNow = mc.mcAxisGetPos(inst,2)
  if xNow<=endX then
    wx.wxMessageBox("start X is less than end Diameter of "..tostring(endX))
    return
  end
  if zNow<=0 then
    wx.wxMessageBox("start Z is less than or = to 0")
    return
  end
  --ts=Timer
 
--rough cuts 
  mc.mcCntlGcodeExecuteWait(inst,"M3 S"..tostring(roughSpeed))
  while (mc.mcAxisGetPos(inst,0)>(endX+finishDOC*2)) do
    currPos=mc.mcAxisGetPos(inst,0)
    maxVal=math.max(endX+2*finishDOC,currPos)
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(plungeFeed).." X"..tostring(maxVal-roughDOC))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(roughFeed).." Z0")
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    currPos=mc.mcAxisGetPos(inst,0)
    maxVal=math.max(endX+2*finishDOC,currPos)
    if currPos==endX+2*finishDOC then
      break
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(plungeFeed).." X"..tostring(math.max(endX+2*finishDOC,currPos-roughDOC)))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(roughFeed).." Z"..tostring(zNow))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end 
    if currPos==endX+2*finishDOC then
      break
    end 
  end
  -- tr=Timer-ts
  --wx.wxMessageBox("Roughing Time: "..tostring(tr))

  --finish cuts
  mc.mcCntlGcodeExecuteWait(inst,"M3 S"..tostring(finishSpeed))

  while (mc.mcAxisGetPos(inst,0)>=(endX+finishDOC)) do
    currPos=mc.mcAxisGetPos(inst,0)
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(plungeFeed).." X"..tostring(currPos-finishDOC))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(finishFeed).." Z0")
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
        return
    end
    currPos=mc.mcAxisGetPos(inst,0)
    if currPos==endX then
      break
    end 
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(plungeFeed).." X"..tostring(currPos-finishDOC))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(finishFeed).." Z"..tostring(zNow))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    currPos=mc.mcAxisGetPos(inst,0)
    if currPos==endX then
      break
    end 
  end
  mc.mcCntlGcodeExecuteWait(inst,"M5\nM9")
--te=Timer-ts
--wx.wxMessageBox("Roughing Time: "..tostring(tr).." - Total Time: "..tostring(te))
end
 
if (mc.mcInEditor() == 1) then
    m6690()
end   

Steve

314
Mach4 General Discussion / Re: Startup problem with Mach 4
« on: February 24, 2017, 06:03:08 PM »
It was time, Vic.  It was time.  :)

Steve

315
On the axis mapping tab of the configuration dialog.  Simply choose a second motor for the Y axis. 

There is no such thing as motor A.  Motors are numbered.  Axes are lettered.  An axis represents a plane of motion.  This motion can be driven by 1 or more motors.  This is an important distinction from Mach 3.  You no longer have to sacrifice an axis to have multiple motors. 

Steve

316
Mach4 General Discussion / Re: Preload-Tool Macro
« on: February 24, 2017, 05:58:16 PM »
Sending data to a PLC almost ALWAYS uses Modbus.  Modbus is the protocol.  It can be used over any transport method that both the Modbus master and Modbus slave have in common.  RS232 and Ethernet are what Mach 4 supports as a Modbus master.  You can use RS485 or RS422 with the appropriate RS323 converter, if you wish. 

There are lot's of threads about Modbus and even the how-to that Steve referred to.  However, we don't attempt to document industry standards that are already very well documented.  Here is a link that summarizes Modbus quite nicely:  http://www.modbusdriver.com/doc/libmbusmaster/modbus.html  Once you understand the mechanism that is Modbus, and along with your PLC documentation, you will then have the glue to put the pieces together. 

And you never mentioned what PLC you are using.  We have no idea and can't read your mind so...  :)

Steve

317
Ahh...  good to know.

Loading G code is an assumed reset.  Because you really want the control in a known state.  Say you had a file that was loaded previously that used G68 rotation.  If the control wasn't reset before loading the new file, it would gank the tool path (and the part!) when the new file is loaded. 

Steve

318
Mach4 General Discussion / Re: Startup problem with Mach 4
« on: February 23, 2017, 07:59:10 PM »
2GB of RAM is going to be a tough one!  It will work, just not painless.  :(

Make sure that the MS print subsystem is installed.  (programs and features in control panel)  Also, you may need to install the VS2013 C/C++ run time package as Administrator in XP.

Steve

320
Mach4 General Discussion / Re: Connecting to Mach4
« on: February 12, 2017, 08:31:09 PM »
0 for success.  Anything else is uncivilized.  :)  Meaning if you get non-zero, there is a problem.  Most likely with Mach not being active or firewall blocking (Uses TCP/IP).

Steve