Problem with bus in a s-function

1 次查看(过去 30 天)
Iban
Iban 2011-5-18
I have a hand-written C S-Function, which compiles but when I execute it, it gives the following error:
" 'Proba1/SFunction' cannot modify the zero representation of data type 'BALISEDATA_MESSAGE'. "
I think my problem can be in the following piece of code:
#ifndef __SL_DTYPE_BALISEDATA_MSG_C__
#define __SL_DTYPE_BALISEDATA_MSG_C__
/* include *******************************************************************/
#include "simstruc.h"
#include "BaliseData_message.h"
DTypeId Register_DType_BALISEDATA_Msg( SimStruct *S )
{
/* Define variables */
int_T status;
DTypeId id;
BALISEDATA_DATATYPE tmp;
/* Register the user-defined data types */
id = ssRegisterDataType(S, "BALISEDATA_MESSAGE");
if(id != INVALID_DTYPE_ID)
{
/* Set the size of the user-defined data type */
status = ssSetDataTypeSize(S, id, sizeof(BALISEDATA_DATATYPE));
if(status == 0)
{
id = INVALID_DTYPE_ID;
}
}
if(id != INVALID_DTYPE_ID)
{
/* Set the zero representation */
uint8_T byteIndex;
tmp.New_Balisse = (boolean_T)0;
tmp.BalissePosition = (real32_T)0;
tmp.GroundInclination = (real32_T)0;
tmp.NextBalissePosition = (real32_T)0;
status = ssSetDataTypeZero(S, id, &tmp);
}
return(id);
}
#endif
Can anybody help me?
  1 个评论
Kaustubha Govind
Kaustubha Govind 2011-5-18
Perhaps the zero representation of the type had already been set to a different value while you were trying this out? Look at the value returned by ssGetDataTypeZero and try doing a memcmp to the value you are trying to set (tmp).

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by