使用simulink生成Autosar C/S接口代碼

一、簡介

本文主要以matlab 2019b版本,主要講解怎麼用simulink生Autosar C/S接口:

1.設置Autosar嵌入式C代碼;

2.加入C/S接口;

二、具體實現方法

matlab simulink 中和Autosar接口對應關係如下表:

simulink對應Autosar接口
Autosae接口 simulink模塊
ReceiverPorts In1
SenderPorts Out1
ClientPorts Function Caller
SeverPorts Function-Caller Subsystem

建立測試模型如下圖:

 

Function Caller 中設置:

1.Function prototype:Test_out2 = ClientPorts(Test_in)  設置函數輸入輸出參數及接口名

2.Input argument specifications (e.g., int8(1)):int8(1)    設置輸入參數數據類型,不填寫默認爲空

3.Output argument specifications (e.g., int8(1)):int16(1)  設置輸出參數數據類型,不填寫默認爲空

點擊Apps->Autosar Component Tools 工具,根據自己需要對模型進行Autosar化,生成Client接口如下

生成代碼如下:

severports接口和上面一樣操作。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章