Hello Guest it is April 29, 2024, 02:29:46 AM

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 - mcardoso

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 »
151
Mach4 General Discussion / Re: Axis Enable API Call?
« on: October 03, 2019, 10:00:10 PM »
Smurph,

Thanks for the reply. I’m thinking you probably gave the entire answer to my question above, but I would like to clarify what I am trying to do just in case there is a way to accomplish it.

I want to achieve the same result as clicking the enable button, but call it from a script. I’m assuming the Enable button on screen enables all the axes, turns on the axis enable outputs, sets the state of Mach to allow code to be run, and updates the graphics on screen. I want to do that (and nothing more) from within the screen load script.

I do not need to enable axes individually.

Where is the code which is called by the enable button stored? Even if this isn’t explicitly in the API, is there a way for a function in the screen load script to access the command?

Can the exact behavior of the enable button be modified (say to prevent enabling the machine if certain inputs are not present)?

152
Mach4 General Discussion / Axis Enable API Call?
« on: October 02, 2019, 05:10:26 PM »
Hi All,

Any idea what API call to use to enable the axes in the same way that clicking the "ENABLE" button on screen does? I would like to enable motion, set the enable output, and change the color of the on-screen enable button at the same time. Again, essentially mimicking what clicking the Enable button does.

I have tried mc.mcAxisEnable(inst, axisID, TRUE) but did not get any response from the motors (but no errors either?)

Thanks!

153
Mach4 General Discussion / Re: Request for LUA advice: Rigid Tapping
« on: September 24, 2019, 08:31:22 AM »
Smurph,

Thanks for the information. I have Mach 4 Hobby so I will be scripting an M code for sure.

Mike

154
Mach4 General Discussion / Request for LUA advice: Rigid Tapping
« on: September 22, 2019, 03:10:45 PM »
Another post here!

Similar to my post about absolute homing, I am able to message my servo drives using serial commands and configure them to have different gear ratios to the Step/Dir input from Mach 4. I have also added a relay in my control cabinet (tied to an output from Mach 4) which physically disconnects the Z axis drive from the Smoothstepper Step/Dir signals and connects it to the encoder output of my spindle motor drive. Using this method, I can cause the Z axis to follow the exact motion generated by my spindle in a true closed loop fashion. By changing the gear ratio at the drive, I can program the threads per inch of the tap that I am using.

With this, I hope to be able to accomplish rigid tapping using the spindle encoder to drive axis motion. This all happens after the smoothstepper and does not rely on any Mach 4 controlled hardware.

My question is, can I modify Mach 4's behavior to a G84 call, or do I need to create a custom M function? Will these functions wait for my code to complete before continuing through the rest of the G code?

155
Mach4 General Discussion / Re: Request for LUA advice: Absolute homing
« on: September 22, 2019, 02:58:09 PM »
I'm sure there are errors in this code but this is what I am imagining for the homing (just the X axis in this example).

The call
Code: [Select]
serialError, XPosition = mcServo.GetPosition(00, XctsInch) is a function from a custom module that messages my servo drive over RS485 serial and returns an error code (usually 0) and a position of the motor using the parameters drive serial address (x axis = 0) and counts per inch.


Code: [Select]

local inst = mc.mcGetInstance()

function absoluteHomeX()
local serialError = 0
local XPosition = nil
mcAxisDerefAll(Inst) --Deref all axes

int rc = mcMotorGetCountsPerUnit(Inst, 0, &XctsInch) --Store the X Axis counts per inch into XctsInch
serialError, XPosition = mcServo.GetPosition(00, XctsInch) --Query the X Axis Drive for the position (in inches from zero)
if serialError~= 0 then --Determine if the serial request failed
XAxisPos = nil
return
end
mcAxisSetPos(Inst, 0, XPosition) --Set the X Axis Position
mcAxisHomeComplete(Inst, 0);  --Mark the X Axis in Mach 4 as referenced
end


156
Mach4 General Discussion / Request for LUA advice: Absolute homing
« on: September 22, 2019, 02:45:33 PM »
Hi again,

I have developed a serial interface from Mach 4 to my Allen Bradley Ultra 3000 servo drives using LUA. One of the capabilities of this interface is to define the zero (home) position of the motor in the servo drive, and later read the current position of the motor back into Mach 4. Since my motors have magnetic multiturn encoders, this position will be stored through power cycles and even when the motor is moved by hand when the machine is powered off. This means that once the home position is set in the servo drive, I will never need to home my CNC again unless the motor is decoupled from the drive or ballscrew.

What I am hoping to do is run the normal homing routine in Mach 4, but modify it to set the zero position in the drive at the same time as it is set in Mach 4. Then going forward, clicking Ref All Home need only ask the drive where it is currently located and copy that data into Mach 4 axis positions.

My questions is this, if I have all my axes dereferenced, can I copy my known motor position into the axis position using mcAxisSetPos(Inst, 0, XPosition)? If so, how do I mark that axis as referenced without running the Mach 4 homing sequence to drive the axes to their limit switches?

Thanks in advance for any help or thoughts on this.

157
Mach4 General Discussion / Request for LUA advice: Startup menu script
« on: September 22, 2019, 01:49:50 PM »
Hi All,

I am looking to create a simple pop-up menu which requires me to click through a number of steps before I can start using the machine. Ideally it would come up as soon as the Mach 4 graphics load, and have the following steps:

1) Oiling reminder
2) Configure my machines servo drives over serial (unique to my machine)
3) Enable the Axes
4) Home the machine
5) Enable Soft Limits
6) Ask if I want to run a spindle warm-up program
etc.

What would be the best LUA element to use for this menu? I guess I could just pop up lots of message boxes, but I was hoping there might be a more intelligent element to use.

158
Mach4 General Discussion / Re: Mach 4 Feature Request
« on: September 22, 2019, 01:45:29 PM »
Silly little request, but can there be a setting to auto enable soft limits when Mach 4 opens? It seems like a feature most people would want turned on normally and it is easy to forget.

159
gusx32x,

The hardwired pendant I purchased is identical to this unit (https://www.ebay.com/p/Universal-CNC-4-Axis-Pendant-MPG-Handwheel-Emergency-Stop-Switch-Controller-US/2223141204?iid=162243912680).

The pigtail was passed into my enclosure through a cable gland and wired into a IDC 26 breakout board like this (https://www.ebay.com/itm/IDC26-26-Pin-Connector-Signals-Breakout-Board-Screw-terminals-Din/302882801596?hash=item468538c7bc:g:myMAAOSwmaVbm1QY). The breakout board connected to the ESS with a 6" ribbon cable.

I chose this breakout board since I couldn't find a simple 3rd port breakout board for the ESS. The only catch is that the terminal numbers that are screen printed on the board don't match the ESS numbers. Not a big deal to me, I just stuck a label over them.

Warp 9 TD has a great configuration tutorial here (https://warp9td.com/index.php/faq/faq-pendants-and-mpgs#MultiWirePendantInMachFour)

Finally, you can see the installation in my build log here (https://www.hobby-machinist.com/threads/g0704-cnc-ac-servo-rebuild-picture-heavy.76222/page-2) starting on post #34.

I found it easy to setup and works very well. I'm sure other pendants will work as well, although I have no experience with them. Coming from industry I have a strong aversion to anything that causes machine motion over wireless, so I opted to use the hardwired variety and have no complaints.

EDIT: The other reason I wanted a hardwired MPG was to be able to use the ESTOP button in my safety string.

160
I use a generic multiwire type ($50 from eBay) and I love it. If you have the digital I/O available then it is very responsive with no drivers to worrk about. I use an Ethernet smoothstepper and dedicated most of the 3rd port to the pendant with a generic IDC-26 breakout board

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 »