libximc
2.14.27
|
To acquire the first skills of using the library, a simple testappeasy_C test application has been created. Languages other than C are supported using calls with conversion of arguments of the stdcall type. A simple C test application is located in the 'examples/test_C' directory, a C# project is located in 'examples/test_CSharp', on VB.NET - in 'examples/test_VBNET', for delphi 6 - in 'example/test_Delphi', for matlab - 'examples/test_MATLAB', for Java - 'examples/test_Java', for Python - 'examples/test_Python', for LabWindows - 'examples/test_LabWindows'. Libraries, header files and other necessary files are located in the directories 'ximc/win32', 'ximc/win64','ximc/macosx' and the like. The developer kit also includes already compiled examples: testapp and testappeasy x32 and x64 bits for windows and only x64 bits for macOS X, test_CSharp, test_VBNET, test_Delphi - only x32 bits, test_Java - cross-platform, test_MATLAB and test_Python do not require compilation, test_LabWindows - 64-bit build is installed by default.
Testapp can be built using testapp.sln. Library must be compiled with MS Visual C++ too, mingw-library. Make sure that Microsoft Visual C++ Redistributable Package is installed.
Open solution examples/testapp/testapp.sln, build and run from the IDE.
In case of the 8SMC4-USB-Eth1 Ethernet adapter usage it is necessary to set correct IP address of the Ethernet adapter in testapp.c file before build (see enumerate_hints variable).
Testappeasy_C and testapp_C can be built using testappeasy_C.cbp and testapp_C.cbp respectively. Library must be compiled with MS Visual C++ too, mingw-library. Make sure that Microsoft Visual C++ Redistributable Package is installed. *
Open solution examples/test_C/testappeasy_C/testappeasy_C/testappeasy_C.cbp or examples/test_C/testapp_C/testapp_C.cbp, build and run from the IDE.
MinGW is a port of GCC to win32 platform. It's required to install MinGW package.
MinGW-compiled testapp can be built with MS Visual C++ or mingw library.
Then copy library libximc.dll to current directory and launch testapp.exe.
In case of the 8Eth1 Ethernet adapter usage it is necessary to set correct IP address of the Ethernet adapter in testapp.c file before build (see enumerate_hints variable).
First of all, you should create a library suitable for C++ Builder. Visual C++ and Builder libraries are not compatible Invoke:
Then compile test application:
In case of the 8Eth1 Ethernet adapter usage it is necessary to set correct IP address of the Ethernet adapter in testapp.c file before build (see enumerate_hints variable).
There is also an unsupported example of using libximc in a C++ Builder project
testapp should be built with XCode project testapp.xcodeproj. Library is a MacOS X framework, and at example application it's bundled inside testapp.app
Then launch application testapp.app and check activity output in Console.app.
In case of the 8Eth1 Ethernet adapter usage it is necessary to set correct IP address of the Ethernet adapter in testapp.c file before build (see enumerate_hints variable). There is also an example of using the libximc library in a C++ Builder project, but it is not supported.
Make sure that libximc (rpm or deb) is installed at your system. Installation of package should be performed with a package manager of operating system. On MacOS X a framework is provided.
Note that user should belong to system group which allows access to a serial port (dip or serial, for example).
Test application can be built with the installed library with the following script:
In case of cross-compilation (target architecture differs from the current system architecture) feed -m64 or -m32 flag to compiler. On MacOS X it's needed to use -arch flag instead to build an universal binary. Please consult a compiler documentation.
Then launch the application as:
Note: make run on MacOS X copies a library to the current directory. If you want to use library from the custom directory please be sure to specify LD_LIBRARY_PATH or DYLD_LIBRARY_PATH to the directory with the library.
In case of the 8SMC4-USB-Eth1 Ethernet adapter usage it is necessary to set correct IP address of the Ethernet adapter in testapp.c file before build (see enumerate_hints variable).
Wrapper assembly for libximc.dll is ximc/winX/wrappers/csharp/ximcnet.dll. It is provided with two different architectures. Tested on platforms .NET from 2.0 to 4.5.1
Test .NET applications for Visual Studio 2013 is located at test_CSharp (for C#) and test_VBNET (for VB.NET) respectively. Open solutions and build it.
In case of the 8SMC4-USB-Eth1 Ethernet adapter usage it is necessary to set correct IP address of the Ethernet adapter in testapp.cs or testapp.vb file (depending on programming language) before build (see enumerate_hints variable for C# or enum_hints variable for VB).
Wrapper for libximc.dll is a unit ximc/winX/wrappers/delphi/ximc.pas
Console test application for is located at test_Delphi. Tested on Delphi 6 and only 32-bit version.
Just compile, place .dll near the executable and run program.
In case of the 8Eth1 Ethernet adapter usage it is necessary to set correct IP address of the Ethernet adapter in test_Delphi.dpr file before build (see enum_hints variable).
How to run example on Linux. Go to to examples/test_Java/compiled-winX/ and run:
How to run example on Windows. Go to to examples/test_Java/compiled-winX/. Then run:
How to modify and recompile an example. Go to to examples/test_Java/compiled. Sources are embedded in a test_Java.jar. Extract them:
Then rebuild sources:
or for Windows or MacOS X
Then build a jar:
In case of the 8Eth1 Ethernet adapter usage it is necessary to set correct IP address of the Ethernet adapter in TestJava.java file before build (see ENUM_HINTS variable).
Change current directory to the examples/test_Python/xxxxtest. NB: For libximc usage, the example uses the wrapper module ximc/crossplatform/wrappers/python/libximc.
To run:
In case of the 8Eth1 Ethernet adapter usage, it's necessary to set correct IP address of the Ethernet adapter in test_Python.py file before launch (see enum_hints variable).
Sample MATLAB program testximc.m is provided at the directory examples/test_MATLAB. On windows copy ximc.h, libximc.dll, bindy.dll, xiwrapper.dll and contents of ximc/(win32,win64)/wrappers/matlab/ directory to the current directory.
Before launch:
On MacOS X: copy ximc/macosx/libximc.framework, ximc/macosx/wrappers/ximcm.h, ximc/ximc.h to the directory examples/test_MATLAB. Install XCode compatible with Matlab.
On Linux: install libximc*deb and libximc-dev*dev of target architecture. Then copy ximc/macosx/wrappers/ximcm.h to the directory examples/matlab. Install gcc compatible with Matlab.
For XCode and gcc version compatibility check document https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2014a_SupportedCompilers.pdf or similar.
On Windows before the start nothing needs to be done
Change current directory in the MATLAB to the examples/test_MATLAB. Then launch in MATLAB prompt:
In case of the 8Eth1 Ethernet adapter usage it is necessary to set correct IP address of the Ethernet adapter in testximc.m file before launch (see enum_hints variable).
If you want to turn on file logging, you should run the program that uses libximc library with the "XILOG" environment variable set to desired file name. This file will be opened for writing on the first log event and will be closed when the program which uses libximc terminates. Data which is sent to/received from the controller is logged along with port open and close events.
libximc generally does not require special permissions to work, it only needs read/write access to USB-serial ports on the system. An exception to this rule is a Windows-only "fix_usbser_sys()" function - it needs elevation and will produce null result if run as a regular user.
C-profiles are header files distributed with the libximc library. They enable one to set all controller settings for any of the supported stages with a single function call in a C/C++ program.
You may see how to use C-profiles in the example directory "examples/test_C/testprofile_C".
Python-profiles are sets of configuration functions distributed with the libximc library. They allow to load the controller with settings of one of the supported stages using a single function call in a Python program.
You may see how to use Python-profiles in the example "examples/test_Python/profiletest/testpythonprofile.py".