Development of PCI board driver in XPC environment

조회 수: 2(최근 30일)
lai Tian
lai Tian 2018년 4월 16일
답변: Xiaohu Li 2021년 6월 5일
My purpose is to implement PCI1706's board driver in XPC environment.
According to an article on the Baidu library that introduced the PCI card driver (, the driver can be realized by c-mex S-function.
Main steps: 1. write the c-mex S-function; 2. mex the c-mex S-function and get the mexw32 file; 3. invoke the mexw32 file according to S-function module in simulink environment.
XPC has provided rl32getpciinfo rl32einpb rl32outpb functions to get PCI board information, write/read registers.
But I found some problems when realizing the driver function.
That is, the codes realizing the driver or calling the xpc functions are wrapped by "#ifndef matlab_mex_file #end if", so it won't actually excute if the S-function is built by "mex". I used the "printf" in the codes wrapped by "ifndef matlab_mex_file" and it didn't output anything, which validates that the codes realizing the driver or calling the xpc functions didn't excute.
If I deleted the "ifndef matlab_mex_file", there will be errors.
So how to realize the PCI board driver in XPC environment?
The codes are as the attach file.


maotong zhang
maotong zhang 2018년 8월 27일
I also encountered the same problem,help me

Xiaohu Li
Xiaohu Li 2021년 6월 5일


Find more on Particle & Nuclear Physics in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by