Beispiel #1
0
    static void mdlRTW(SimStruct *S)
    {
        boolean_T showData   = P_SHOW_DATA;
        boolean_T showID     = P_SHOW_ID;
        boolean_T showLength = P_SHOW_LENGTH;
        uint32_T       endian     = P_ENDIAN;
        ssWriteRTWParamSettings(S,4,

                SSWRITE_VALUE_DTYPE_NUM, "ShowID",
                &showID,
                DTINFO(SS_BOOLEAN,0),

                SSWRITE_VALUE_DTYPE_NUM, "ShowLength",
                &showLength,
                DTINFO(SS_BOOLEAN,0),

                SSWRITE_VALUE_DTYPE_NUM, "ShowData",
                &showData,
                DTINFO(SS_BOOLEAN,0),

                SSWRITE_VALUE_DTYPE_NUM, "Endian",
                &endian,
                DTINFO(SS_UINT32,0)

                );
    }
Beispiel #2
0
static void mdlRTW(SimStruct *S){
   int_T type     = P_TYPE;
   int_T id       = P_ID;
   DTypeId  dataType = ssGetInputPortDataType(S,0);
   int_T length   =ssGetDataTypeSize(S,dataType) * ssGetInputPortWidth(S,0); 
   int32_T       endian     = P_ENDIAN;

   /* -- Write Invariant Parameter Settings -- */
   ssWriteRTWParamSettings(S,4,
         SSWRITE_VALUE_DTYPE_NUM, "TYPE",
         &type,
         DTINFO(SS_UINT32,0),

         SSWRITE_VALUE_DTYPE_NUM, "ID",
         &id,
         DTINFO(SS_UINT32,0),

         SSWRITE_VALUE_DTYPE_NUM, "LENGTH",
         &length,
         DTINFO(SS_UINT16,0),

         SSWRITE_VALUE_DTYPE_NUM, "Endian",
         &endian,
         DTINFO(SS_UINT32,0)
      );

   /* -- Write Invariant Signal Settings -- */
   if ( !mxIsFinite( ssGetSampleTime( S, 0 ) ) ) {
      CAN_FRAME * frame = (CAN_FRAME *) ssGetOutputPortSignal(S,0);
      CAN_write_rtw_frame(S,frame);
   }

}
/* Function: mdlRTW ============================================================
 * Abstract:
 *    This function is called when the Real-Time Workshop is generating the
 *    model.rtw file. In this routine, you can call the following functions
 *    which add fields to the model.rtw file.
 *
 *    Important! Since this s-function has this mdlRTW method, it is required
 *    to have a correcponding .tlc file so as to work with RTW. You will find
 *    the sfun_directlook.tlc in <matlabroot>/toolbox/simulink/blocks/tlc_c/.
 */
static void mdlRTW(SimStruct *S)
{
  const uint8_T sample_time = SAMPLE_TIME;
  const uint8_T port = PORT;
  const uint8_T sw = SW;

  if (!ssWriteRTWParamSettings(S, 3,
       SSWRITE_VALUE_DTYPE_NUM, "sample_time", &sample_time, DTINFO(SS_INT8,COMPLEX_NO),
       SSWRITE_VALUE_DTYPE_NUM, "port", &port, DTINFO(SS_UINT8,COMPLEX_NO),
       SSWRITE_VALUE_DTYPE_NUM, "sw", &sw, DTINFO(SS_UINT8,COMPLEX_NO)))  {
    ssSetErrorStatus(S, "Light Sensor Switch:ParamError");
     return;/* An error occurred which will be reported by Simulink */
  }

}