How can I interface a set of 32-bit hardware registers with a Simulink Model generated using Simulink encoder?

조회 수: 5 (최근 30일)
I have a simulink model that simulates the flight dynamics of a guidance system. The inputs to the model and outputs from the model are relayed to/from a single board computer via a set of 32-bit hardware registers that are accessible on card over a PCI bus.
In general, what would be the best approach? The goal is to minimize the amount of hand-crafting and to minimize the number changes to non-model code everytime changes to the model are made? And what would be the most appropriate MATLAB/Simulink tools for this task?
Thanks in advance.
  댓글 수: 2
Kaustubha Govind
Kaustubha Govind 2013년 8월 15일
Do you have a set of drivers/libraries from the vendor to interface with the registers from, say, a C/C++ application?
Douglas Robinson
Douglas Robinson 2013년 8월 19일
It is custom hardware and I have written a driver. Really all the hardware consists of is a set of memory-mapped 32-bit registers accessible over a PCI bus.

댓글을 달려면 로그인하십시오.

채택된 답변

Kaustubha Govind
Kaustubha Govind 2013년 8월 19일
편집: Kaustubha Govind 2013년 8월 19일
You can use C-MEX S-functions to create custom driver blocks that call into your C driver code. Please use the Legacy Code Tool to automatically generate an S-function wrapper for your driver code. You can then use the resultant S-function like any other Simulink block.
  댓글 수: 2
Douglas Robinson
Douglas Robinson 2013년 8월 19일
What I think you are suggesting is to replace each inport and outport block of the model with a C-MEX S-function that performs either a memory-mapped I/O read from or write to the appropriate register. Is that correct?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by