Table of Contents |
---|
In order to allows direct communication between MATLAB and EPICS, we used the epics-labca from GitHub.
While the library building in a Linux system is quite simple and works fine, the building into a Windows System needs some particular attention to be achieved.
...
- the epics-labca source files downloaded from GitHub
- Epics installed on your device
- Matlab installed on your device
In my case, epics was 7The present guide describes an installation based on: epics7.0 version and Matlab R2022.
In Windows environment it would be preferred that those program were installed in a path without blank spaces. Maybe is not necessary, but I did.
...
Change the EPICS_BASE value with the installation path of your EPICS, at the base level
No need for EPICS_BASE ro to be compounded by a BASE_SUBDIR.
...
If you're compiling for Windows, uncomment and change the value of MATLIB_SUBDIR with the RELATIVE path between your ${MATLABDIR}/lib and the location of directory where is located the library 'libmex.lib' is found
BUILDING THE LIBRARY
In a Linux system, just run the make command and the building procedure should be completed without errors.
...
In a Windows System, you should before have a compiling environment.
I Used For this purpose we used Microsoft Visual Studio Community Edition 2022
Then, you have to install a make tool, because is not already present in Windows.
I Used For this purpose we used Gnu Make 4.3 installed by Chocolatey
...
Open the glue/mglue.h file and edit the line 91 that was
void lcaMexGblInit();
trasforming it in:
epicsShareFunc void epicsShareAPI lcaMexGblInit();
This is necessary because Windows for default doesn't export functions into library. It must be explicitly declared, differently from Linux.
...
Now, launching a MAKE command in the Prompt for VS should run correctly and creating a subfolder of the matlab library folder, in which you will have all the .mexw64 that you need to put into your matlab.
You will need also the dll created in the folders ezca (ezcamt.dll) and in the folders glue (mezcaglue.dll)
Precompiled Build for Windows
View file | ||||
---|---|---|---|---|
|
Using LABCA within MATLAB
Extract the precompiled build for Windows (Win10-64bit-labca.zip) in any folder. Set a new path within MATLAB to this folder. By doing this it is possible to use all the LABCA functions through the MATLAB console and within any script.
A list of all the functions and how to use them is present in the LABCA-manual, downloaded from https://till-s.github.io/epics-labca/:
View file | ||||
---|---|---|---|---|
|
IMPORTANT NOTE:
In order to find an EPICS device through TCP/IP, it is needed to create a new system variable with the list of the devices IP.
In order to do so:
- Click on the search button of the WINDOWS task bar
- Search for "Visualizza Impostazioni di sistema Avanzate"
- In "Avanzate" tab, click "Variabili d'Ambiente"
- Create a new "System Vatiable" named EPICS_CA_ADDR_LIST
- Insert the device IP. To insert multiple devices, insert multiple IP's, separated by black space.