当前位置:网站首页>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 .
边栏推荐
- Image recognition - Data Cleaning
- Record personal understanding and experience of game console configuration
- 在SQL注入中,为什么union联合查询,id必须等于0
- ZK configuration center -- configuration and use of config Toolkit
- Number structure (C language) -- Chapter 4, compressed storage of matrices (Part 2)
- FragmentTabHost实现房贷计算器界面
- Bold prediction: it will become the core player of 5g
- Image recognition - data augmentation
- What is the function of laravel facade
- Demand delineation executive summary
猜你喜欢

In depth analysis of how the JVM executes Hello World

Mysql默认事务隔离级别及行锁

图像识别-数据清洗

Chrome video download Plug-in – video downloader for Chrome

2837xd 代码生成——补充(3)

图像识别-数据标注

Number structure (C language -- code with comments) -- Chapter 2, linear table (updated version)

自定義Redis連接池

攻防世界-Web进阶区-unserialize3

Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)
随机推荐
zk配置中心---Config Toolkit配置与使用
上班第一天的报错(Nessus安装winpcap报错)
C语言之二进制与十进制
Solutions to Chinese garbled code in CMD window
记录一下初次使用Xray的有趣过程
Insight into cloud native | microservices and microservice architecture
C language programming problems
Methods of classfile
MySQL事务
道阻且长,行则将至
Say goodbye to 996. What are the necessary plug-ins in idea?
PI control of three-phase grid connected inverter - off grid mode
QT signal slot summary -connect function incorrect usage
Ckeditor 4.10.1 upload pictures to prompt "incorrect server response" problem solution
图像识别-数据清洗
定时线程池实现请求合并
Safety production early warning system software - Download safety production app software
Beats (filebeat, metricbeat), kibana, logstack tutorial of elastic stack
Bugkuctf-web21 (detailed problem solving ideas and steps)
QT qlabel style settings