Azzera filtri
Azzera filtri

Problem with bus in a s-function

2 visualizzazioni (ultimi 30 giorni)
Iban
Iban il 18 Mag 2011
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 Commento
Kaustubha Govind
Kaustubha Govind il 18 Mag 2011
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).

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by