585,737 active members*
4,627 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms
Results 1 to 16 of 16
  1. #1
    Join Date
    Jul 2014
    Posts
    26

    64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Hi All,

    I'm attempting to use the wonderful Kflop from MATLAB, a popular numeric computing platform. My initial plan is to use the KMotion_dotNet dll since MATLAB has a .NET interface.


    Unfortunately MATLAB stopped supporting releasing 32 bit versions many years ago and now only provides versions for 64 bit Windows. This means it is impossible to load 32 bit libraries into MATLAB applications.
    I wonder if there is a 64 bit version of the libraries, or KMotion, or if anyone knows of a workaround?


    Possible solutions which come to mind:
    - Compile 64 bit version of the KMotionDLL or KMotion_dotNet.dll (though I guess this will require building of some associated libraries and may snowball into a big task)
    - Run old version of MATLAB with 32 bit release. Unfortunately not an option since there are other backwards compatibility issues with our applications.
    - Build some sort of intermediary/wrapper application. For example, I can imagine a 32 bit process running in a WOW64 compatibility layer will be able to load the 32bit library. MATLAB could communicate with this process via pipes or sockets.


    But before I go further, I suspect this may have been an issue for someone previously or has an idea for a more elegant solution?

  2. #2
    Join Date
    May 2006
    Posts
    4045

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Hi gperkins,

    A few years ago a 64 bit version was made (from KMotion Version 4.33q) and seems to work properly. Unfortunately it hasn't been updated since but depending on what you are trying to do it might work fine.

    Here is a link.

    Otherwise the 32 bit and 64 bit versions of 4.33q might be compared and the changes merged into a current Version.

    HTH
    TK
    http://dynomotion.com

  3. #3
    Join Date
    Jul 2014
    Posts
    26

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Hi Tom,

    That is extremely helpful thanks! I've just dowloaded it and see that KMotion excecutable doesn't run (missing GCodeInterpreter.dll). Looks like some of the libraries are not built.
    Do I need to compile them using the BuildAllLibs VS solution, or is this intentionally a barebones 64 bit build of the KMotion_dotNet library? Which is fine for me - as long as it can work that way!

  4. #4
    Join Date
    May 2006
    Posts
    4045

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Yes use BuildAllLibs.sln to create the binaries. You will probably want the Release code. Use VS 2015 to have less issues
    TK
    http://dynomotion.com

  5. #5
    Join Date
    Jul 2014
    Posts
    26

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Thanks Tom. Since my last post I've continued chipping away at this. I see Kmotion, KMotionCNC applications in this release are 32 bit. That's fine, I only need the libraries.


    The 64 bit libraries built successfully from VS2015. Just needed a tweak to the build config to target 64 bit & build for Release.
    I also had to copy 64 bit FTDI drivers into the KMotion release directory (ftd2xx.lib ftd2xx64.dll)


    I tried running a couple of the example applications (also recompiled 64 bit) and got as far as a message about wrong FW on the Kflop board, so I used a working (32 bit) installation of KMotion 433q to flash the correct firmware.


    Now, running SimpleCoeffLoad.exe I get a KMotionDLL Error Extracting version information from DSPKFLOP.out. So looks like I still have something to track down
    I might also try using the Kmotion_dotNET library instead instead of KMotionDLL..


    I'll update with any further progress. Meanwhile, any hints will be gratefully received.

    Attached Thumbnails Attached Thumbnails dialog.png  

  6. #6
    Join Date
    May 2006
    Posts
    4045

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    I think I found the bug. This structure in COFF.h had 2 pointers _n_nptr[2] that were read in as binary structures from the COFF file. Switching to x64 changes the pointers from 32 to 64 bits which throws off the alignment in the COFF file. Changing back to 32 bit fields as shown below seems to solve the issue. Those fields aren't used in our app anyway,

    Code:
    struct syment
    {
        union
        {
            char            _n_name[SYMNMLEN];      /* old COFF version */
            struct
            {
                long    _n_zeroes;      /* new == 0 */
                long    _n_offset;      /* offset into string table */
            } _n_n;
    //      char            *_n_nptr[2];    /* allows for overlaying */
            int            _n_nptr[2];    /* 2 32 bit fields - tktk - allows for overlaying */
        } _n;
        long                    n_value;        /* value of symbol */
        short                   n_scnum;        /* section number */
        unsigned short          n_type;         /* type and derived type */
        char                    n_sclass;       /* storage class */
        char                    n_numaux;       /* number of aux. entries */
    };
    TK
    http://dynomotion.com

  7. #7
    Join Date
    Jul 2014
    Posts
    26

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    That did the trick thanks, the example works. It also seems to be working fine with MATLAB now - I've made a quick video showing it running.

    https://www.youtube.com/watch?v=xMWeBA-eBL0

    I'm not sure if it's expected with the dot_Net library, but if KMotion/KMotionServer aren't running, I get an error "Unable to execute:\r\rKMotionServer.exe\r\rTry re-installing software or copy this file to the same location as KMotion.exe". So I just make sure it's running first.

    Thanks very much for your help, Tom.

  8. #8
    Join Date
    May 2006
    Posts
    4045

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Great. Does the example launch KMotionServer.exe correctly if it isn't already running?

    You might add the location of KMotionServer to the Windows PATH environmental variable.

    Anyway you seem to have handled it well.
    TK
    http://dynomotion.com

  9. #9
    Join Date
    Jul 2014
    Posts
    26

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Adding the location of KMotionServer to the Windows PATH environmental variable sorts that out, thanks!

  10. #10
    Join Date
    Feb 2023
    Posts
    18

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Hi, I'm having the same need for 64-bit libraries of KMotion - it looks like you have made some very good progress in getting it working!

    Would you be willing to share the compiled libraries/KMotion? It would be a massive help.

    Many thanks

  11. #11
    Join Date
    Aug 2023
    Posts
    2

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    here's a possible solution:

    Considering MATLAB's lack of 32-bit support and the need for Kflop integration, you could explore the option of creating an intermediary/wrapper application. This approach involves setting up a 32-bit process to run within a WOW64 compatibility layer, enabling it to load the 32-bit library. MATLAB could then communicate with this intermediary application using pipes or sockets. While it may involve additional development, this method might provide the compatibility you're looking for between MATLAB and the KMotion libraries.for my location and 32- bit support

  12. #12

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Quote Originally Posted by TomKerekes View Post
    Yes use BuildAllLibs.sln to create the binaries. You will probably want the Release code. Use VS 2015 to have less issues
    Hello Tom. I found "KMotion5.2.1x64" in the dynomotion downloads. its libraries seem x64 builded. I plan to install KMotion5.2.1, flash kflop and reboot, then replace all files with KMotion5.2.1x64. Do you have any tips for this version?

  13. #13
    Join Date
    May 2006
    Posts
    4045

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Hi,

    You should just be able to unzip KMotion5.2.1x64 and use it like any other installation and it has the x64 libraries pre-built in the \KMotion\Release64 folder.

    KMotion.exe is only a 32 bit app in \KMotion\Release

    We hope to have a normal installation soon.

    See also the wiki here.
    TK
    http://dynomotion.com

  14. #14
    Join Date
    Jul 2014
    Posts
    26

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Sure, here you go. I'm using the KMotion_dotNet.dll in the release directory.
    https://www.dropbox.com/scl/fi/pppan...o50nz9fu1&dl=0
    However, I see the post blow about a newer version KMotion5.2.1x64. This is probably a better bet for you
    I hope this helps.

    Quote Originally Posted by scintam View Post
    Hi, I'm having the same need for 64-bit libraries of KMotion - it looks like you have made some very good progress in getting it working!

    Would you be willing to share the compiled libraries/KMotion? It would be a massive help.

    Many thanks

  15. #15
    Join Date
    May 2006
    Posts
    4045

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Note the 32/64-bit code has been released. See the 5.3.0 announcement here.
    TK
    http://dynomotion.com

  16. #16
    Join Date
    Jul 2014
    Posts
    26
    This is brilliant, thanks very much Tom.
    Confirmed it's working fine for me.

    Great to have Kmotion and KmotionCNC working too!
    I hope that it's possible to continue to distribute 64-bit version for future releases too.

    Thanks,
    George

    Quote Originally Posted by TomKerekes View Post
    Note the 32/64-bit code has been released. See the 5.3.0 announcement here.

  17. #17
    Join Date
    May 2006
    Posts
    4045

    Re: 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms

    Hi George,

    Thanks for the time for posting back.

    Yes all future Versions will include both 32 and 64-bit Versions.
    TK
    http://dynomotion.com

Similar Threads

  1. 32 bit TNG-Version?
    By retro1 in forum PlanetCNC
    Replies: 1
    Last Post: 08-29-2022, 09:18 AM
  2. Replies: 0
    Last Post: 12-06-2016, 02:41 AM
  3. Maximum milling bit size/glue residue left on bit
    By neeboy in forum CNC Tooling
    Replies: 3
    Last Post: 06-02-2015, 08:20 AM
  4. Undercut with lollipop bit in what version?
    By Forrest C in forum BobCad-Cam
    Replies: 1
    Last Post: 02-12-2015, 10:41 PM
  5. Will a solid carbide bit cut faster that a straight cutting bit?
    By Apples in forum DIY CNC Router Table Machines
    Replies: 1
    Last Post: 09-11-2006, 01:10 PM

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
  •