586,043 active members*
3,600 visitors online*
Register for free
Login
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2004
    Posts
    13

    UCCNC Plug-In

    Hi guys,
    i'm to trying to write a Plug-.in in C#, in particular I would like to send the X-Y-Z coordinates to an external display/arduino via serial port.
    I already found an example inside the the software, but i'm searching for a a basic guide-lines to begin to write the code.
    What is clear to me (i hope) at the moment is:
    - need to write a DLL that call the UCCNC Dll controller;
    - from the UCCNC Dll i can use only the fields and buttons states, and use these to know the coordinates.

    Is right or I made a mistake of interpretation.

    What is the basic code to write initially to prepare the communication beetween my Dll and UCCNC Dll?

    Thanks to all, and have a nice day.

    Vincenzo

  2. #2
    Join Date
    Oct 2005
    Posts
    1145

    Re: UCCNC Plug-In

    The plugins Documentation is not very well defined at this point. They have a very specific layout that you have to use in order for it to show up in UCCNC. Also there is NO serial COM function yet for UCCNC yet.

    Best to contact CNCDrives directly for more info on Plugins and their structure.

    (;-) TP

  3. #3
    dubble Guest

    Re: UCCNC Plug-In

    There are only a few requirements for a plugin dll to work, these are:

    1.) You have to create a .NET 2.0 project in Visual Studio or select the .NET 2.0 CLR if your project is already created in a different CLR version.
    2.) You must define a class with the following name and place your functions inside: public class UCCNCplugin
    3.) You have to include the plugininterface.dll of the UCCNC, you can find this file in the UCCNC directory.
    4.) You have to define a function where the UCCNC can grab the details of your plugin, an example
    public Plugininterface.Entry.Pluginproperties Getproperties_event(Plugininterface.Entry.Pluginpr operties Properties)
    {
    Properties.author = "CNCdrive Kft.";
    Properties.pluginname = "Plugintest";
    Properties.pluginversion = "1.0001";
    return Properties;
    }

    If you have these things done then the plugin should show up in the UCCNC software if you will place your plugin .dll into the plugins folder.

    And you have events for the configuration, the showup, the initialisation, the button press, a loop event etc. these are defined in the example plugin code supplied in the UCCNC software installation.
    These events are called by the UCCNC application as the names of the events suggests.

    And to call functions from your plugin to the UCCNC you should create an instance of the Plugininterface.Entry class, like:
    public Plugininterface.Entry UC;

    Then if you can use the functions of this class to give calls, grab datas from the UCCNC, in Visual Studio when you will type UC. the intellisense of Visual Studio will show you the callable methods.
    You can read DROs, LEDs, check button states etc.

    And to write the position DROs values to serial port is not so difficult, Visual Studio has a COM object which you can use to output data via a serial port or a virtual serial port on a USB port etc.
    One article on the subject: Serial Comms in C# for Beginners - CodeProject

    I know a project which is very similar to what you want to do, not with an Arduino, but with a PIC micro with USB-HID, here is the project link, there is a video on the webpage and downloads for the project with source codes:
    -- [ USB LED Panel plugin UCCNC-hez ] --

    Also I think the example plugin supplied with the UCCNC is a very good starting point, because it has all the interfces defined.

  4. #4
    Join Date
    Oct 2005
    Posts
    1145

    Re: UCCNC Plug-In

    I had seen that BUT it does not tell anything about manipulating the LCD display. It only winks the LEDs on the board (;-)

    It would be nice IF there was a skeleton example file of what is needed to start up a project. Then you can simply add in whatever else you need. That way at LEAST you know you have the base info correct and you are not chasing your tail on errors.

    Been there, (;-) TP

  5. #5
    Join Date
    Jul 2004
    Posts
    13

    Re: UCCNC Plug-In

    Thanks dubble.
    I've modified the example contained in UCCNC plug-in directory.
    My next step is to implement a Serial Port object in my project.

    Update as soon as possible.

  6. #6
    Join Date
    Jul 2004
    Posts
    13

    Re: UCCNC Plug-In

    This is the result of my first test on the "PluginTest" contained in the PlugIn folder.
    I report only the section modified:



    /Called in a loop with a 25Hz interval.
    public void Loop_event()
    {




    if (loopstop)
    {
    return;
    }

    loopworking = true;

    if (myform == null || myform.IsDisposed)
    return;

    if (firstrun)
    {
    firstrun = false;
    //INSERIRE QUI IL CODICE DA ESEGUIRE SOLO AL PRIMO AVVIO

    }

    try
    {
    SerialPort Seriale = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
    Seriale.Open();

    Seriale.WriteLine(UC.Getfield(true, 226));
    Seriale.WriteLine(UC.Getfield(true, 227));
    Seriale.WriteLine(UC.Getfield(true, 228));



    myform.label1.Text = "X: " + UC.Getfield(true, 226);

    myform.label2.Text = "Y: " + UC.Getfield(true, 227);
    myform.label3.Text = "Z: " + UC.Getfield(true, 228);
    myform.label4.Text = "A: " + UC.Getfield(true, 229);
    myform.label5.Text = "Avanzamento: " + UC.Getfield(true, 867);
    myform.label6.Text = "Attuale: " + UC.Getfield(true, 868);

    Seriale.Close();

    }
    catch (Exception) { }

    loopworking = false;

    }


    Now i receive to my serial port, in this case COM3, the X-Y-Z cordinate at a 25Hz interval: tested with a Serial Sniffer it's work very well, without latency on response UCCNC.
    Next step write the code on Arduino to read the COM3 output and write on lcd display.

  7. #7
    dubble Guest

    Re: UCCNC Plug-In

    Nice to see your progress.
    I think what else you will have to do on the UCCNC plugin side is to add somekind of syncronisation to the data stream, the easiest IMO is to add a character at the beginning of the data, e.g. any letters would be fine,
    because you sending coordinates, so sending any letters will not occur in the stream, so they could be used as a sync char.
    I mean to send e.g.:

    S
    1.0000
    2.0000
    3.0000
    and so on...

    So, in this case the Arduino will know that the char 'S' is the beginning of the packet and can easily assign the rest of the data.
    A more complicated, more robust protocol could be also done, I just wanted to give you the basic idea now...

  8. #8
    Join Date
    Jul 2004
    Posts
    13

    Re: UCCNC Plug-In

    Thanks dubble for your advice.
    Upgrade as soon as possible.

Similar Threads

  1. New CNC from China Need to hook up 220v wire and plug, to plug in.
    By zlswain in forum CNC Machine Related Electronics
    Replies: 49
    Last Post: 06-20-2019, 02:10 PM
  2. UCcnc CAM
    By vmax549 in forum UCCNC Control Software
    Replies: 4
    Last Post: 09-16-2016, 04:19 PM
  3. UCCNC Wizards (;-)
    By vmax549 in forum UCCNC Control Software
    Replies: 6
    Last Post: 09-20-2015, 02:35 AM
  4. Has anyone really used UCCNC?
    By greggv in forum UCCNC Control Software
    Replies: 3
    Last Post: 08-16-2015, 10:45 AM
  5. Replies: 2
    Last Post: 08-20-2010, 06:41 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •