Hello Guest it is April 18, 2024, 11:03:07 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 - RegeG

Pages: 1
1
has this project been completed/perfected?

Well - no project is every "perfected".

It works and I've been using it.  I don't use it heavily and there's still room for improvement - but it's sufficient for the current "hobbyist" level of CNC plasma cutting I do.

I lost interest is updating and posting as there's been little interest or feedback.

2
This is an ongoing development.......

I've been working on an Arduino-based Torch Height Controller for a while.  I currently have the hardware design stable and functional and mostly complete THC code.  While there is a Windows-based app to control the THC - I've recently been working on a Mach Plugin.

This is my first Mach Plugin.  I have initial functionality working.  The plug-in communicates with the THC over a user configurable COM port.  It allows setting the THC operating mode, setting the target cutting voltage and monitoring the operation.

The plugin spawns a new thread for handling the serial port communications.  It also gives the ability to set Mach's "THC Mode" to ON when starting.  (There is a configuration option to stop and restart the serial thread - that doesn't work yet.  If you change the serial port you have to stop and restart Mach.)

Software source code, hardware design information and a user guide is available on github under the "regeg/ArduinoTHC" project.
   https://github.com/regeg/ArdunioTHC

Video of the test cuts with steel on a steep incline can be seen at:
  http://www.youtube.com/watch?v=H2GjW5V7YFs

All of the history of the development and lots of voltage captures of cutting are on the Plasma forum at the Everlast Generators site.
  http://www.everlastgenerators.com/forums/forumdisplay.php/13-Everlast-Plasma-Cutters-(PAC)

I'd really like to get people building the THC and contributing to the project.

3
I'd still like to understand what's going on - but I've worked around it in a slightly more processor intensive way.

Instead of blocking on the read, I did the following.......

void ReadSomeBytes(array<unsigned char>^ buffer, UInt16 offset, UInt16 count)
{
   while ((MG::thcData.thcSerial->BytesToRead < count))
   {
      // Kill the thread if requested.
      if (MG::thcControl.hariKari)
         ExitThread(0);
      // Didn't get killed, so sleep a little
      Sleep(5);
   }

   // Read the bytes.
   MG::thcData.thcSerial->Read(buffer, offset, count);
}

 ("hariKari" is a boolean flag that the plug-in uses to signal the serial input processing thread to gracefully shut down.)

4
I can start a thread and output serial data constantly without problems.

As soon as I do a serialPort->ReadByte() or serialPort->Read(buf, 0, 1) - I get an error on start up of Mach.  It's "Art Code: 8877".

I've tried it both with blocking reads and with a timeout.

Anybody have any insights on "Art Code 8877"?

Thanks

5
It seems like you always find the answer yourself after posting a question.

Thinking it might be an issue with static classes (which I think are truly evil) - I went to just using Win32 to start the thread:
   MG::hndlSerialThread = CreateThread(NULL, 0, SerialProcessing, NULL, 0, 0);

That worked fine.

6
I'm just starting my first plugin for Mach3.

I'm using the Plugin Wizard with Studio 2008.  I'm able to build and run a plugin, but when trying to start a thread - it doesn't seem to start.  (Currently the thread just tries to open a serial port and dump data.)

I have an object that contains the serial port access code and another that starts a new thread and calls the serial port access code.  I can create the object and call the method to just open the port and spew data and that works.  If I try to create a thread with that then calls the serial port access code nothing happens.

The worker method is:

   public ref class ThcInterface
   {
   public:
      static void DoWork() { SpewData() };
                static void SpewData() { <code> };

        };

I start it with:
       Thread^ comThread = gcnew Thread( gcnew ThreadStart(&ThcInterface::DoWork) );
and I don't get any data.

Calling "SpewData" directly will give serial data.

Is it possible to use .NET threading with the Plugin wizard?  I'm wondering if this is a mixed mode issue.  Any guidance threading with Mach3?


Thanks.


Pages: 1