資源簡(jiǎn)介
用Simulink接收串口數(shù)據(jù),用S-Function函數(shù)去解析串口數(shù)據(jù)包,詳情見(jiàn)博客: https://blog.csdn.net/humanking7/article/details/80856505
代碼片段和文件信息
#define?S_FUNCTION_NAME??unPackData_Q
#define?S_FUNCTION_LEVEL?2
#include?“simstruc.h“
#include?“DataType.h“//收發(fā)數(shù)據(jù)類(lèi)型
static?void?mdlInitializeSizes(SimStruct?*S)
{
????/*?See?sfuntmpl_doc.c?for?more?details?on?the?macros?below?*/
????ssSetNumSFcnParams(S?0);??/*?Number?of?expected?parameters?*/
????if?(ssGetNumSFcnParams(S)?!=?ssGetSFcnParamsCount(S))?{
????????/*?Return?if?number?of?expected?!=?number?of?actual?parameters?*/
????????return;
????}
????ssSetNumContStates(S?0);
????ssSetNumDiscStates(S?0);
????if?(!ssSetNumInputPorts(S?1))?return;//一個(gè)輸入
????ssSetInputPortWidth(S?0?16);//16維
????ssSetInputPortRequiredContiguous(S?0?true);?/*direct?input?signal?access*/
????/*
?????*?Set?direct?feedthrough?flag?(1=yes?0=no).
?????*?A?port?has?direct?feedthrough?if?the?input?is?used?in?either
?????*?the?mdlOutputs?or?mdlGetTimeOfNextVarHit?functions.
?????*?See?matlabroot/simulink/src/sfuntmpl_directfeed.txt.
?????*/
????ssSetInputPortDirectFeedThrough(S?0?1);
????if?(!s
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件??????13824??2018-06-28?23:12??unPackData_Q.mexw64
?????文件???????5506??2018-06-28?23:11??unPackData_Q.c
?????文件????????480??2018-06-28?22:25??DataType.h
?????文件??????23987??2018-06-29?04:24??recCom.mdl
?????文件??????27142??2018-06-29?14:19??recCom_Union.mdl
-----------?---------??----------?-----??----
????????????????70939????????????????????5
評(píng)論
共有 條評(píng)論