当前位置:网站首页>2837xd code generation module learning (4) -- idle_ task、Simulink Coder
2837xd code generation module learning (4) -- idle_ task、Simulink Coder
2022-07-02 09:43:00 【Quikk】
2837xd Code generation module learning (4)——idle_task、Simulink Coder modular
Model links : link
1 idle_task
idle_task Module in C2000 Support package library Scheduling In subclass , Figuratively speaking, it realizes our in the writing process while(1) modular . Its setting is shown in the figure below :
The second attribute in the figure is the preemption flag , It means when the sign is 1 when , Allow external interrupts to break the original execution ( That is, when executing sub functions , Allow the interrupt ).
The framework of the model is as follows :
There are two idle_task, A preemptive sign is 0( The other is for 1).
experimental result :
In the generated code, it is obvious that the functions triggered by both modules are while In circulation .
Go into the subfunction , You can see that the generated sub functions are as follows :
Task1 The preemption flag of is 0, The function generated here also does not allow interruption during execution .
Task2 The preemption flag of is 1, The generated function does not close the interrupt .
2 Simulink Coder
Compile the timing for the control module ,Simulink Provides Simulink Coder library , Today, I mainly tested three modules :1.Model Header 2.Model Source 3. System Initialize
1.Model Header ( Header file library ) Fill in the parameters as follows , The difference between the two boxes is that one is defined at the top , One is defined at the bottom .
2.Model Source ( Function file ) Fill in the parameters as follows :
These two are also the same .
3.System Initialize This determines the position in the initialization function .
Let's take a look at the generated code for verification :
.c The beginning of the file is defined ;
.c The end of the file is also defined , It is consistent with what we filled in the module .
.h Macro definition is carried out at the beginning of the file :
.h Macro definition is carried out at the end of the file :
The header and middle of the initialization function carry out relevant code execution :
Relevant code execution is carried out at the end of the initialization function :
3 Priority settings
The module distribution is shown in the figure below
The priority can be set through the unified level of modules : Right click on the module , choice Properties,
Then check Priority Set it up ( The smaller the number, the higher the priority )
So you can see in the generated code ,GPIO84 The operation of is prior to GPIO67.
The module is almost completed here , Now I'm ready to learn StateFlow Match and Simulink Build a model , Try making another little thing . Here is my view on model building : Model building should be divided into two parts: bottom driver and Algorithm , The driving part of the bottom layer can be built through the model . Algorithm by Simulink After the simulation , Peel off the outside , Separately packaged into modules . Define the input 、 Output , adopt Matlab coder It can be converted into C Code . It can also be associated with generated DSP Program model for interface connection , Then generate the corresponding code execution .
边栏推荐
- 2837xd code generation - Summary
- 2837xd 代码生成——补充(3)
- YOLO物体识别,生成数据用到的工具
- Bugkuctf-web24 (problem solving ideas and steps)
- Probability is not yet. Look at statistical learning methods -- Chapter 4, naive Bayesian method
- Knowledge points are very detailed (code is annotated) number structure (C language) -- Chapter 3, stack and queue
- BugkuCTF-web21(详细解题思路及步骤)
- Enterprise level SaaS CRM implementation
- Off grid control of three-phase inverter - PR control
- Break the cocoon | one article explains what is the real cloud primordial
猜你喜欢
2837xd code generation - Summary
FragmentTabHost实现房贷计算器界面
PI control of grid connected inverter (grid connected mode)
MySQL事务
Idea view bytecode configuration
DTM distributed transaction manager PHP collaboration client V0.1 beta release!!!
Image recognition - Data Cleaning
Bugkuctf-web21 (detailed problem solving ideas and steps)
PI control of three-phase grid connected inverter - off grid mode
Bugkuctf-web24 (problem solving ideas and steps)
随机推荐
College Students' CET-4 and CET-6 composition template (self created version, successfully crossed CET-6)
分布式锁的这三种实现方式,如何在效率和正确性之间选择?
The road is blocked and long, and the line is coming
Chrome video download Plug-in – video downloader for Chrome
QT qlabel style settings
VIM操作命令大全
Pool de connexion redis personnalisé
Mysql 多列IN操作
Redis 序列化 GenericJackson2JsonRedisSerializer和Jackson2JsonRedisSerializer的区别
Read 30 minutes before going to bed every day_ day3_ Files
MySql报错:unblock with mysqladmin flush-hosts
C语言之数据插入
Inverter Simulink model -- processor in the loop test (PIL)
Required request body is missing:(跨域问题)
每天睡觉前30分钟阅读_day3_Files
MySQL multi column in operation
BugkuCTF-web24(解题思路及步骤)
JVM instruction mnemonic
个人经历&&博客现状
在SQL注入中,为什么union联合查询,id必须等于0