Description of Problem:
I have recently bought an Advantech PCIe-1816H DAQ card in order to implement a real-time SISO (MISO) control application (with sampling rates up to 20 KHz) inside the Simulink software (Simulink Desktop Real Time (SLDRT) kernel) using a 64bit MATLAB / Windows 10. (I have previously performed real-time control applications using Advantech PCI-1710HG, PCI-1720 DAQ cards on a 32bit MATLAB / Windows). So far, the Advantech Company has not supported its DAQ cards on a 64bit version of MATLAB. In other words, no MATLAB DAQ Adaptor kit is released by Advantech Company.
I want to write my own customized Analog Input / Output Blocks to be able to communicate with Advantech DAQ cards (PCI-1710HG, PCI-1720, PCIe-1816H) on a 64bit SIMULINK / Windows using SLDRT kernel. Both MATLAB and Advantech DAQNavi help documentations have Software Development Kit (SDK) sections which describe how to extend the functionality of the MATLAB DAQ / IMAQ toolboxes as well as Advantech DAQ cards. Yet, I do not know how to solve my problem? And where to start from? I have got a little bit confused, due to the huge amount of data around this subject.
1) The MATLAB Documentation provides a template for development of custom DAQ / IMAQ adaptors in order to support new hardware via MATLAB Data Acquisition / Image Acquisition toolboxes. In the given examples a directory of C++ source files / header files are compiled in order to build a 64bit MEX (MATLAB Executive) file. Some of the required files are related to the vendor device driver and library of API functions provided by hardware vendor (As provided by Advantech Company in its DAQNavi software package). In fact, the functionality of this MEX file is to connect the MATLAB DAQ / IMAQ toolbox to the Hardware Device Driver. Finally, the newly-registered hardware can be accessed by the Data Acquisition toolbox via the Session-Based Interface. Should I follow this approach in order to develop my customized Advantech I/O device drivers for real-time data acquisition using SLDRT kernel? 2) The Simulink Real Time (SLRT) software provides an environment to write a device driver for unsupported hardware boards via S-Functions (Please refer to Device Driver Guide) and (Please refer to Simulink Documentation) . The Simulink Real-Time software has its own kernel, and you write the device drivers aimed at that kernel. Are the developed I/O blocks (via S-Functions) can be used with SLDRT Kernel. In other words, should I follow this approach in order to develop my customized Advantech I/O device drivers for real-time data acquisition using SLDRT kernel? Is this approach applicable to PCIe DAQ boards? 3) According to The Simulink Desktop Real-Time Documentation , the Data Acquisition boards, provided by various hardware vendors, are often used for data acquisition independently of Simulink Desktop Real-Time software. In such environments, board manufacturers usually provide their own I/O Device Drivers for data acquisition purposes. This type of usage differs significantly from the behavior of drivers provided with Simulink Desktop Real-Time software. So the question that arises is: What are the requirements of developing a custom real-time I/O Device Driver for Advantech (or any other manufacturer) hardware applicable inside Simulink Desktop Real-Time software?
What is the best solution for creating a custom IO device driver (adaptor) for an unsupported Hardware (Here Advantech DAQ boards) in order to perform basic Analog Input and Analog Output operations in a real time control application (with MATLAB 64bit SLDRT kernel)? and what are the most important requirements?