当前位置:网站首页>2837xd代码生成模块学习(4)——idle_task、Simulink Coder
2837xd代码生成模块学习(4)——idle_task、Simulink Coder
2022-07-02 06:35:00 【Quikk】
2837xd代码生成模块学习(4)——idle_task、Simulink Coder模块
模型链接: 链接
1 idle_task
idle_task模块位于C2000支持包库的Scheduling子类中,形象地说就是实现了我们在书写程序中的while(1)模块。其设置如下图:
图中第二个属性是抢占标志,意思是当标志为1时,允许外部中断来打破原有的执行(即在执行子函数时,允许中断)。
模型框架如下:
这里设置了两个idle_task,一个抢占标志为0(另外一个为1)。
实验结果:
在生成代码中可以明显看到两个模块触发的函数都在while循环中。
进入子函数,可以看到生成的子函数如下:
Task1的抢占标志为0,这里生成的函数也不允许中断在执行过程中打断。
Task2的抢占标志为1,生成的函数并没有关闭中断。
2 Simulink Coder
为了控制模块编译时序,Simulink提供了Simulink Coder库,今天主要测试了三个模块:1.Model Header 2.Model Source 3. System Initialize
1.Model Header (头文件库)参数填入如下,这个两个框不同的是一个在顶部定义,一个在底部定义。
2.Model Source (函数文件)填入参数如下:
这两个也是同上。
3.System Initialize这个决定了在初始化函数中的位置。
下面看一下生成的代码进行验证:
.c文件开头进行了定义;
.c文件结尾也进行了定义,与我们在模块中填写一致。
.h文件开头进行了宏定义:
.h文件结尾进行了宏定义:
初始化函数头部和中部进行了相关的代码执行:
初始化函数末尾进行了相关的代码执行:
3 优先级设置
模块分布如下图
通过对统一层次的模块可以进行优先级的设置:右击模块,选择Properties,
然后在对话框中对Priority进行设置(数字越小优先越高)
因此可以看到在生成代码中,GPIO84的操作先于GPIO67.
模块到这里差不多就全部完成了,下面准备学习一下StateFlow配和Simulink进行搭建模型,再做个小东西试试。这里说一下我对模型搭建的看法:模型搭建应该分成底层驱动和算法两部分,底层的驱动部分可以通过模型搭建。算法通过Simulink仿真后,剥离外部,单独封装做成模块。定义好输入、输出,通过Matlab coder可以转换成C代码。也可以与生成的DSP程序的模型进行接口的连接,然后生成对应的代码执行。
边栏推荐
- C language programming problems
- Who is better for Beijing software development? How to find someone to develop system software
- 图像识别-数据标注
- How to use pyqt5 to make a sensitive word detection tool
- ZK configuration center -- configuration and use of config Toolkit
- Difference between redis serialization genericjackson2jsonredisserializer and jackson2jsonredisserializer
- DTM distributed transaction manager PHP collaboration client V0.1 beta release!!!
- How to choose between efficiency and correctness of these three implementation methods of distributed locks?
- 因上努力,果上随缘
- Alibaba /热门json解析开源项目 fastjson2
猜你喜欢
Break the cocoon | one article explains what is the real cloud primordial
QT QLabel样式设置
Chrome浏览器插件-Fatkun安装和介绍
Redis installation and deployment (windows/linux)
Microservice practice | Eureka registration center and cluster construction
Off grid control of three-phase inverter - PR control
Read 30 minutes before going to bed every day_ day4_ Files
Bold prediction: it will become the core player of 5g
Required request body is missing:(跨域问题)
Difference between redis serialization genericjackson2jsonredisserializer and jackson2jsonredisserializer
随机推荐
Idempotent design of Internet API interface
定时线程池实现请求合并
YOLO物体识别,生成数据用到的工具
hystrix 实现请求合并
Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)
记录下对游戏主机配置的个人理解与心得
Discussion on improving development quality and reducing test bug rate
MySql报错:unblock with mysqladmin flush-hosts
Chrome user script manager tempermonkey monkey
Bugkuctf-web16 (backup is a good habit)
Save video opencv:: videowriter
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
Long summary (code with comments) number structure (C language) -- Chapter 4, string (Part 1)
Image recognition - Data Cleaning
记录一下初次使用Xray的有趣过程
CKEditor 4.10.1 上传图片提示“不正确的服务器响应” 问题解决
Attributes of classfile
QT信号槽总结-connect函数错误用法
Navicat remote connection MySQL reports an error 1045 - access denied for user 'root' @ '222.173.220.236' (using password: yes)
Amq6126 problem solving ideas