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


Results 1 to 16 of 16

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

  1. #1
    Member
    Join Date
    Jul 2014
    Posts
    26
    Downloads
    0
    Uploads
    0

    Default 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?

    Similar Threads:


  2. #2
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default 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

    Regards
    TK http://dynomotion.com


  3. #3
    Member
    Join Date
    Jul 2014
    Posts
    26
    Downloads
    0
    Uploads
    0

    Default 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
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default 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

    Regards
    TK http://dynomotion.com


  5. #5
    Member
    Join Date
    Jul 2014
    Posts
    26
    Downloads
    0
    Uploads
    0

    Default 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.

    64 bit version of KMotion libraries for MATLAB and other 64 bit platforms-dialog-png

    Attached Thumbnails Attached Thumbnails 64 bit version of KMotion libraries for MATLAB and other 64 bit platforms-dialog-png  
    Last edited by gperkins; 02-02-2023 at 03:29 PM. Reason: add image


  6. #6
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default 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 */
    };


    Regards
    TK http://dynomotion.com


  7. #7
    Member
    Join Date
    Jul 2014
    Posts
    26
    Downloads
    0
    Uploads
    0

    Default 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.



    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
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default 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.

    Regards
    TK http://dynomotion.com


  9. #9
    Member
    Join Date
    Jul 2014
    Posts
    26
    Downloads
    0
    Uploads
    0

    Default 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

    Default 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
    Member jpenaherrerac's Avatar
    Join Date
    Feb 2020
    Posts
    1
    Downloads
    0
    Uploads
    0

    Default 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?



  12. #12
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default 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.

    Regards
    TK http://dynomotion.com


  13. #13
    Member
    Join Date
    Jul 2014
    Posts
    26
    Downloads
    0
    Uploads
    0

    Default 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




  14. #14
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default 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.

    Regards
    TK http://dynomotion.com


  15. #15
    Member
    Join Date
    Jul 2014
    Posts
    26
    Downloads
    0
    Uploads
    0

    Default

    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.




  16. #16
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default 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.

    Regards
    TK http://dynomotion.com


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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

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

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