Hello Guest it is February 03, 2023, 10:33:38 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 - freedom2000

Pages: 1 2 3 4 »

I have not given up :-)

I just have to finish the PIC code and upgrade my CNC with my plasma torch.
I just need time.. not enough to do all I want to do   >:(


Finished Plugins for Download / Re: Free USB JoyPad plugin
« on: October 08, 2010, 02:24:32 PM »
Hi JP,

sorry for not seeing your post before.

I am using standard Microsoft Multimedia calls to access the JoyPad, Joystick or game device - no fancy USB HID communication. Interface to the calls can be found in <mmsystem.h>, and c++ statements like:

Opening the code will not help you with USB HID devices, but I can help with my use of Microsoft multimedia interface.

I just released a new version 1.0 of the plugin with support for SmoothStepper, User manual and new samples of VBScript code. The post can be found at:

- area51

Ok it's clear --> thanks


Mach SDK plugin questions and answers. / Re: SetLED function
« on: August 18, 2010, 02:49:42 AM »

   Ed Bryson is a TOTAL programming GURU!!!!  He does alot with PICs as well, and he turned me on to the using a demo PIC board and MPLAB. Ed lives close to me, and I am lucky enough to go over to his house and sit at the feet of Yoda.......  :)

Really nice job, and especially the USB stuff, that crap can be a super duper pain in the but to use the windows native HID/USB.


You are right, I have been really impressed by Ed's skills and even more by his video tutorials which are a real evidence of his kindness.
You are lucky to live close to Yoda !
As he doesn't read his own forum, if you see him please tell him that he begins to be famous in France too :-)

The Usb stuff is a real pain, but thanks to Microchip's dll it's no more than 1 line to discover and attach the device.
I will post the pcb layout and the source code both for the plugin and the PIC when a bit more "finished".
With less than 15€ you can increase Mach3's IO in an easy and affordable way !
I know that the pokeys is there and its plugin really nice... but I wanted to do mine, just for fun !


Mach SDK plugin questions and answers. / Re: Plug in
« on: August 17, 2010, 06:00:23 PM »

I have a PCI1240-U Advantech board  but Mr.Hood in mach forum told me that i need to write a plug in for this board but i don't know what is plug in and how can i write it.
I don't have enough information about this board like wiring map or software adjustment.
Can someone help me please.

Thank you

Oups it seems to be a rather specific board... It won't be easy to write a plugin...

May be some Mach3 Gurus ???


Mach SDK plugin questions and answers. / Re: SetLED function
« on: August 17, 2010, 02:52:18 AM »
Thank you Scott for this clear answer.

I had in mind something like this but I wanted to be sure  ;)

I have found another way to do the trick : with Engine->InSigs(x).Activated = true;

This PIC18F4550 is really a simple device. Here is a simplified version of the PICDem board (which can be simplified even more if you supress the RS232 connector and circuitry). I have equiped it with a few leds, buttons and pots to test the board.
35 IOs are accessible includng 13 AD converters on 10 bits.

The board itself remains very compact. This is a simulation but the real one looks the same !!

And finally a working small plugin based on the excellent Ed Byron's MachPluginWizard.

It does nothing but :
- checking the connection
- when pushing a button : reset Z DRO, Spindle toggle
- when turning a potentiometer : Spindle Speed adjustment

This a simple exemple, but it is so funny to see how easily a plugin can be done --> Great program Art !

The youtube video is here : http://www.youtube.com/watch?v=El08JLbPhG8

Thanks again for your help Scott


Mach SDK plugin questions and answers. / SetLED function
« on: August 16, 2010, 04:53:23 AM »
Hi all,

I have successfully connected my PICDem custom board as an HID device to Mach3 using Ed's MachPuginWizard and a dll provided by Microchip.
This board is using a PIC18F4550 USB device

So currently, I am able to :
- input digital IO to Mach3
- input analog IO to Mach3
- output digital IO to my board
- output DRO  "value" to my board

The code is extremly simple and works very well for :
- GetDRO()
- SetDRO()
- GetLED()
- code()

BUT I still have a strange behavior with the SetLED function.

It is well recognized, the compilation and link work well. But when running nothing happens... The led state doesn't change at all.

Here is the code of the piUpadte function.

As you will see it is still a quite simple prototype (just to discover the great capabilities of Mach3 plugins  ;))

It does the following :

- check if the PICDem board is connected
if yes
- looks at if a button is pressed
- if yes toggles the Spindle (M3, M5 Gcode)
- Tries to toggle the flood  with the SetLED function which doesn't work
- clears the Z DRO

and finally gets an analog input to update the Spindle Speed DRO

Please any help would be appreciated for the SetLED function !!!


Code: [Select]
void piUpdate()
if (MG::xyzDemoDialog)
double ADCValue = 0;

XYZDemoDialog^ xyzDemoDialog = MG::xyzDemoDialog;
if (MCHPHIDClass::USBHIDIsConnected () == true)
xyzDemoDialog->textBoxX->Text =  "Connected";
unsigned char OutputPacketBuffer[64]; //Allocate a memory buffer equal to our report size
unsigned char InputPacketBuffer[64]; //Allocate a memory buffer equal to our report size

OutputPacketBuffer[0] = 0x81; //0x81 is the "Get Pushbutton State" command in the firmware

if (MCHPHIDClass::USBHIDWriteReport (OutputPacketBuffer, 1) == true)
MCHPHIDClass::USBHIDReadReport (InputPacketBuffer);
//InputPacketBuffer[0] is an echo back of the command.
//InputPacketBuffer[1] contains the I/O port pin value for the pushbutton (1 = not pressed, 0 = pressed). 
if(InputPacketBuffer[1] == 0x01)
xyzDemoDialog->textBoxY->Text = "Not Pressed"; //Update the pushbutton state text label on the form, so the user can see the result
else //InputPacketBuffer[1] must have been == 0x00 instead
xyzDemoDialog->textBoxY->Text =  "Pressed"; //Update the pushbutton state text label on the form, so the user can see the result

SetDRO(802, 0); // clears the Z DRO

if (GetLED(11)== true) // get the staus of the Spindle
Code("M5"); // stops the spindle (if running)
xyzDemoDialog->textBoxY->Text =  "spindle OFF";

SetLED(13, false); //DOES NOT WORK (should stop the flood)
Code("M3"); // start the spindle (if not running)
xyzDemoDialog->textBoxY->Text =  "spindle ON";

SetLED(13, true); // DOES NOT WORK (should start the flood)


ADCValue = (double)(((InputPacketBuffer[3] << 8) + InputPacketBuffer[2])*30); //Need to reformat the data from two unsigned chars into one unsigned int.
SetDRO(817, ADCValue); //SpindleSpeed 817 updated with analog input from PICDem


xyzDemoDialog->textBoxX->Text = "Disconnected";
xyzDemoDialog->textBoxY->Text = "Not Pressed"; //Update the pushbutton state text label on the form, so the user can see the result

xyzDemoDialog->textBoxZ->Text = GetDRO(202).ToString("F4"); //SpindleSpeed Overwrite


what are you trying to do?  Are you trying to call a DLL from inside of a Mach plugin? or what?


I am not the author of this thread, but as I had the same question... Yes I wanted to call a dll from a Mach3 plugin.
I have now succeeded.. My only problem was that the dll must be located in the same folder as Mach3.exe and not into the plugin directory...

It was finally simple :-)



To start with pulgins I wanted to reference this dll into your code and call it.

I have added a reference to it into Visual Studio
I have modified the code to refrence the namesapce : using namespace HIDClass;
and just added a dll call to check the usb attachement : MCHPHIDClass::USBHIDClassInit (0x4D8, 0x003F, 64);

Well just two lines of modifications... The compilation and link are OK

but when running on the second line (the call to the dll) I have a fatal error :

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
Additional information: Impossible de charger le fichier ou l'assembly 'HID class, Version=1.0.3376.23070, Culture=neutral, PublicKeyToken=null' ou une de ses dépendances. Le fichier spécifié est introuvable.

Which in english means that the dll is not found...


Hi all,

I have found by myself. It was quite easy just had to put the dll into the Mach3 folder close to Mach3.exe ...

Now the dll is called !

And thanks again to Ed for his wizard

Hi all,

I have tried to compile anf run the shuttlePro example provided in the SDK

The compilation is OK, link also

After I put the dll in the Mach3/plugins folder and run Mach3

what I get is : Error triggered Art code 904
then after ignoring : error stopping timer
then Mach3 crashes...

Any idea of what is wrong ?

BTW, what I want to do is to have an example of source code using usb HID IF. And shuttlePro seems to have one !

thanks in advance

Hi have exactly the same question (with an HIDclass dll) an no answer ...

so following also your thread !


Pages: 1 2 3 4 »