MATLAB Answers

How should I write a custom driver in order to perform Analog Input / Output operations with an unsupported Advantech Hardware using Simulink Desktop Real Time?

11 views (last 30 days)
DesoliDs
DesoliDs on 25 Jul 2017
Commented: ammar al jodah on 4 Dec 2018
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.
Extra Details:
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?
Conclusion:
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?

Answers (1)

ammar al jodah
ammar al jodah on 4 Dec 2018
Edited: ammar al jodah on 4 Dec 2018
you need register map from Advantech in order to be able to write Simulink realtime device driver, the cards PCI-1710HG, PCIe-1816H do not have any register map in their manual but PCI-1720 has the register map . So writing a custom driver for PCI-1710HG and PCIe-1816H is impossible, however for the other card (PCI-1720), Advantech did provide the register map so using that it can be programmed. I wrote a driver for PCI-1716 and PCI-1723 for simulink realtime , writing a driver for 1720 is not that complicated.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!