The 'ssSetInputPortDataType' command accepts the following Built In Data Type Ids:
- SS_DOUBLE /* real_T */
- SS_SINGLE /* real32_T */
- SS_INT8 /* int8_T */
- SS_UINT8 /* uint8_T */
- SS_INT16 /* int16_T */
- SS_UINT16 /* uint16_T */
- SS_INT32 /* int32_T */
- SS_UINT32 /* uint32_T */
- SS_BOOLEAN /* boolean_T */
In order to accept data of type uint64_T and int64_T the 'ssRegisterDataTypeFxpBinaryPoint' command can be used to define a custom 'DTypeID' object. The following example would produce a 'DTypeID' object corresponding to uint64_T:
DTypeId DataType_SS_UINT64 = ssRegisterDataTypeFxpBinaryPoint(
S,
0, // unsigned
64, // 64 bit
0, // 0 fraction length
1 );
'DataType_SS_UINT64' can then be passed as an argument to the 'ssSetInputPortDataType' and 'ssSetOutputPortDataType' functions. The corresponding S-Function Block will then be able to accept data of type 'ufix64'.
Additional information on the 'ssRegisterDataTypeFxpBinaryPoint' command can be found here:
Note that in order to use the 'ssRegisterDataTypeFxpBinaryPoint' you must include 'fixedpoint.h' and 'fixedpoint.c' in your S Function. Additionally, for fixed-point C S-functions, pass an extra argument '-lfixedpoint' in the mex command as shown below and in the following link:
>> mex('sfun_user_fxp_asr.c','-lfixedpoint')
Best Answer