Hello Guest it is March 28, 2024, 11:08:32 AM

Author Topic: Machine control via USB  (Read 4661 times)

0 Members and 1 Guest are viewing this topic.

Machine control via USB
« on: November 11, 2009, 02:38:37 AM »
Hi together,

I try to get some infos about MACH3 for evaluate the suitability for my project. I hope, someone can tell me, whether its possible.

I have to control a micro welding machine. The machine parameter are complete controllable via USB. Now I build a manipulator with (now) two axis with servos. The motors are immediate controllable with MACH3, clear. But the problem is, I have to send commands via USB in the right order together with the positioning commands in the G-code. The needed USB commands are controlling parameters like welding current and some other voltages.

For this, I have to send commands via USB in/between the "G-code". I think, this will not work without a plugin. But the question is: Is this possible with a plugin or I'am at a wrong track?

The USB access in C++ is not the problem, only the connection to MACH3.  

Thanks Karsten
Re: Machine control via USB
« Reply #1 on: November 11, 2009, 09:30:00 AM »
Hi Karsten,

the way I would do this:

use Macros in the G-Code for your parametersettings.

So as an example : switch Welding Current to 10 Amperes

M10001 P10

then there is a file M10001.m1s with the code

Code: [Select]
Declare Sub SetCurrent Lib "WeldControl" (ByVal Parameter1 As Double)
DIM Ampere as double

Ampere = Param1()

Call SetCurrent (Ampere)

And at last the plugin will have:

Code: [Select]
EXTERN_C DLLEXPORT void SetCurrent (double ampere)
{
  // set the current with USB-Calls
}

Bye, Steffen
Re: Machine control via USB
« Reply #2 on: November 11, 2009, 10:26:57 AM »
Hi Steffen,

this is exactly what I mean, many thanks!

Can you tell me, whether its possible to pass several variables, as example M10001 P10 P20, or is it limited to one? What means the P in "P10" exactly?

Bye, Karsten
Re: Machine control via USB
« Reply #3 on: November 11, 2009, 11:20:28 AM »
I must say, I didn't check for the parameter usage and didn't check it for correct work, it's just from the Mach customization wiki, where you can get the P Q and R Parameter with Param1(), Param2() and Param3()

The part with the call to the DLL is checked, I use it in my Plugins.

For method with Param1 check the wiki

Good luck,

Steffen
Re: Machine control via USB
« Reply #4 on: November 12, 2009, 01:03:58 AM »
@Steffen
Thanks for help.

Bye, Karsten