level 2 c-mex function input return wrong value

158 views Asked by At

I have a TLC generated mexfunction with 2 inputs and 0 output. input 1 is unsigned char and input 2 is unsigned int.

When I try to get input values with:

unsigned char *u1 = ssGetInputPortSignal(S,0);     (uint8)    
unsigned int  *u2 = ssGetInputPortSignal(S,1);     (uint16)

mexPrintf("value1 %d\n",*u1);
mexPrintf("value2 %d\n",*u2);

why u2 depends on u1?

for example: in simulink the input port #1 = 2;*u1= 2;

but in simulink the input port #2 = 1000;*u2= *u2 +(*u1*65636);

I see this in mexprint..

I get u2 with a factor depends on the first input port

I set InputPortRequiredContiguous and InputPortDirectFeedThrough to 1.

0

There are 0 answers