Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
S-function Port defined as a pointer

Subject: S-function Port defined as a pointer

From: Cesar

Date: 24 Oct, 2013 15:01:16

Message: 1 of 2

I am trying to send a pointer between two connected S-functions. The idea is to create an array wihtin one S-function and send its pointer to other connected S-functions in order to write the results in the same memory allocation. The problem is that when configuring the ouput/input ports, the only types accepted are the following, and it doesn't seem possible to define a port as a pointer:

Integer Data Type ID (DTypeId) Built-in Data Type
0 SS_DOUBLE
1 SS_SINGLE
2 SS_INT8
3 SS_UINT8
4 SS_INT16
5 SS_UINT16
6 SS_INT32
7 SS_UINT32
8 SS_BOOLEAN

In my case i want to to rasterize primitives on a frame memory. For that, I generate an array (frame) in one S-function, and send its pointer to other S-functions that draw on the frame rectangles, characters, lines, etc.

Thank you.

Subject: S-function Port defined as a pointer

From: Phil Goddard

Date: 25 Oct, 2013 00:25:08

Message: 2 of 2

The datatypes you list are the only datatypes recognised as a simulink signal (at least by default).

Your choices are
- output an integer representing the correct number of byes for your pointer and have your subsequent S-Functions know how to correctly handle the integer as a pointer. (This may change on a platform by platform basis).

- register a custom datatype using the ssRegisterDatatype macro.
This approach specifically precludes doing any code generation (with Simulink Coder).

Phil.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us