当前位置:网站首页>MATLAB/Simulink&&STM32CubeMX工具链完成基于模型的设计开发(MBD)(三)
MATLAB/Simulink&&STM32CubeMX工具链完成基于模型的设计开发(MBD)(三)
2022-07-31 03:57:00 【小师兄1995】
前言
基于上两篇内容,本篇博客借助于STM32提供的MATLAB硬件支持包完成基于模型的开发。此工具链用到的工具为MATLAB/Simulink和STM32CubeMX,而省略了Keil工具进行手工代码集成的步骤,所有的工作仅在MATLAB/Simulink和STM32CubeMX完成。
注:应用此工具链需要安装STM32硬件支持包,STM32CubeMX和STM32CubeProgrammer,并进行硬件环境配置。
一、概述
设计需求:通过按键控制两个LED的状态,按一次按键两个LED亮,再按一次按键两个LED以1s时间间隔交替闪烁,再按一次按键,两个LED灭。
控制器:STM32F407ZG
应用层开发:MATLAB/Simulink
底层配置:STM32CubeMX
二、使用步骤
1.硬件设计
指示灯:LED0、LED1
按键:KEY0
2.软件设计
1、MATLAB->APP->Run on Hardware Board,选择目标开发板。我的板子是STM32F407ZG,因此选STM32F4xx Based
2、新建STM32CubeMX工程,配置底层。配置PF9、PF10为输出,PE4为输入,进行Project Manager设置,保存工程
3、在MATLAB中打开设置将STM32CubeMX工程进行加载,进入MATLAB/Simulink进行应用层编程。
4、MATLAB编程如下
4.1安装STM32硬件支持包后在Simulink会出现该支持包的硬件资源
4.2读取PE4的状态,当产生一个下降沿表明按键KEY0被按下,触发子系统运行。触发第一次,子系统输出0;触发第二次,子系统输出1;触发第三次子系统输出3,重复循环。
4.2当触发子系统输出0时,关闭LED0、LED1,PF9、PF10输出1。
4.3当触发子系统输出1时,打开LED0、LED1,PF9、PF10输出0。
4.4当触发子系统输出2时,LED0和LED1成流水状态,1s间隔周期
5、设置求解器,自动处理数据传输的速率转换
6、打开开发板,点击Builid Deploy & Start,等待下载完成观察实验现象。
7、实验现象
0730
边栏推荐
- 识Flutter 基本组件之showTimePicker 方法
- Just debuted "Fight to Fame", safety and comfort are not lost
- With 7 years of experience, how can functional test engineers improve their abilities step by step?
- (8) Math class, Arrays class, System class, Biglnteger and BigDecimal classes, date class
- $attrs/$listeners
- 【AUTOSAR-RTE】-5-Explicit(显式)和Implicit(隐式) Sender-Receiver communication
- 5. How does the SAP ABAP OData service support the $filter operation
- 「 每日一练,快乐水题 」1331. 数组序号转换
- BP神经网络
- SIP Protocol Standard and Implementation Mechanism
猜你喜欢
C语言从入门到如土——数据的存储
[C language] General method of base conversion
LocalDate addition and subtraction operations and comparison size
BP神经网络
【小土堆补充】Pytorch学习笔记_Anaconda虚拟环境使用
[Compilation principle] Design principle and implementation of recursive descent parsing
(5) final, abstract class, interface, inner class
SIP Protocol Standard and Implementation Mechanism
(4) Recursion, variable parameters, access modifiers, understanding main method, code block
Daily practice of LeetCode - palindrome structure of OR36 linked list
随机推荐
[C language] Three-pointed chess (classic solution + list diagram)
Pytest电商项目实战(上)
[Swift]自定义点击APP图标弹出的快捷方式
(五)final、抽象类、接口、内部类
Summary of Huawei Distributed Storage FusionStorage Knowledge Points [Interview]
Detailed explanation of TCP and UDP
Based on the local, linking the world | Schneider Electric "Industrial SI Alliance" joins hands with partners to go to the future industry
(六)枚举、注解
(6) Enumeration and annotation
els block to the right
[CV project debugging] CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT problem
浅识Flutter 基本组件之showDatePicker方法
微软 AI 量化投资平台 Qlib 体验
日志级别 和 打印log注意
"DeepJIT: An End-To-End Deep Learning Framework for Just-In-Time Defect Prediction" paper notes
$attrs/$listeners
IDEA常用快捷键与插件
端口排查步骤-7680端口分析-Dosvc服务
Automation strategies for legacy systems
C语言从入门到如土——数据的存储