当前位置:网站首页>2837xd code generation - stateflow (4)
2837xd code generation - stateflow (4)
2022-07-02 09:37:00 【Quikk】
2837xd Code generation ——StateFlow(4)
16 Chart debugging
stay Animation You can set the transfer speed of the debugging process .

16.1 Set breakpoint type :
1)chart Only When entering The breakpoint of :

After hitting the breakpoint , There will be corresponding signs in the lower left corner .

2)State Breaking point , There are three types :I、 Get into State II、 stay State in III、 sign out State

After hitting the breakpoint ,State2 The corresponding logo will appear in the lower left corner , Click to see the breakpoint type :

3) Same operation , Transfer can also break into breakpoints :

4) stay Model Explorer You can set breakpoints for events in :

16.2 Breakpoint management :
Click any breakpoint , Click... In the dialog box that appears Breakpoints List Enter breakpoint management . This breakpoint management is not limited to a certain model , If you open multiple models , Then the breakpoints of multiple models will be displayed on the breakpoint management .

The breakpoint management interface is as above , The official routine used here (Command Window Input sf_car You can enter ). On the interface of breakpoint management Condition The meaning is : When the conditions are met , Breakpoints will take effect . This follows C The middle break point , We sometimes hope that in the cycle , How many times does the loop enter the breakpoint .Hits Is the number of times to enter the breakpoint .
Breakpoints can be located faster Chart What's wrong with .
17 Watch Data
On the signal line , Right click to select join Watch Data Window:

After choosing , Will pop up Watch Data Window The window of . hinder DEBUG that will do .
18 call Work Space Variable
The basic language format of the call is
y=ml.x; //x Need to be in Work Space Has been defined in ;
Be careful : Need to put chart The action language of is set to C Verbal action (Matlab Language doesn't work )

Other operations are the same as routine :

Here you can quickly define the callback function of the model , Define , Exempt from manual definition ( Please refer to the callback function for details Simulink explain ):


ml Statements can also be overloaded :
y=ml('sin(%f)',u); //u yes Work Space The variable of , there sin The function can be replaced by any Matlab Is a built-in function of
y=ml.my_sin(u); //my_sin I wrote it myself matlb Function file

19 StateFlow call c Code
Write them separately .c and .h The files are placed in the same directory :

Then enter Configuration Parameters The relevant settings are made in :


And then in Chart Call in . Here, because the introduction is C Language file , So action language must be chosen C Language .
20 2837d Use Chart Build models and build examples
Here is a real-time timer module , It is divided into initialization module and XINT Module and counter module .

1) Variables are used here Data Store Memory modular , In the attribute, you can Set the type of variable .

2) Initialization module . initialization KEY Used as an external interrupt , Originally wanted to use LED The light indicates the initialization process , But it failed . as a result of : The generated code will GPIO The two instructions of are placed in step Function to run . Now I think of , Directly add the functions of lighting and extinguishing in the initialization module . Because the code added by the initialization module is always placed at the end of the initialization function . For example : If the generated code is used GPIO0 As I/O Use , Then it must be initialized in the initialization module . In the initialization code, you can directly use bit operation to GPIO Port assignment can be operated . But the following steps must be used GPIO0.( Only in this way can it be initialized ).

3) External interrupt function module , The functions of the two interrupt functions here are the same . Are in interrupt functions , take (0-1 loop ) The value of is stored in the variable (XINT1、XINT2) in . If the last execution XINT function , What's stored is 0, Then the next execution will store 1. This produces the rising edge of a pulse . The corresponding falling edge can be generated . This edge signal can be used as Chart Events .


4)Chart The module realizes the function of counting , Can be XINT1、XINT2 Start and reset the count respectively . there TIC The event is an event that occurs with the step size 0、1 Sequence , If the step size is set to 0.01, So when it comes to execution 100 Time TIC event . It can be considered that 1 second . after 60s will min Designated as +1. Pay attention because ccs Use c Code driven , So here chart The action language must be c Language .


5) experimental result . It's directly on here SCI_A Enter simulation mode , Then press the key to enter Running:


边栏推荐
- 在SQL注入中,为什么union联合查询,id必须等于0
- Typeerror: X () got multiple values for argument 'y‘
- Beats (filebeat, metricbeat), kibana, logstack tutorial of elastic stack
- Ora-12514 problem solving method
- Chrome浏览器标签管理插件–OneTab
- Knife4j 2. Solution to the problem of file control without selection when uploading x version files
- What are the differences between TP5 and laravel
- Number structure (C language) -- Chapter 4, compressed storage of matrices (Part 2)
- Oracle modifies tablespace names and data files
- Matplotlib swordsman - a stylist who can draw without tools and code
猜你喜欢

西瓜书--第五章.神经网络

vs+qt 设置应用程序图标

Microservice practice | Eureka registration center and cluster construction

DTM distributed transaction manager PHP collaboration client V0.1 beta release!!!

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

洞见云原生|微服务及微服务架构浅析

分享一篇博客(水一篇博客)

Break the cocoon | one article explains what is the real cloud primordial

The channel cannot be viewed when the queue manager is running

Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
随机推荐
DTM distributed transaction manager PHP collaboration client V0.1 beta release!!!
Matplotlib swordsman line - first acquaintance with Matplotlib
Discussion on improving development quality and reducing test bug rate
一篇详解带你再次重现《统计学习方法》——第二章、感知机模型
并网逆变器PI控制(并网模式)
MySQL default transaction isolation level and row lock
Microservice practice | load balancing component and source code analysis
Watermelon book -- Chapter 6 Support vector machine (SVM)
How to use PHP spoole to implement millisecond scheduled tasks
Hystrix implements request consolidation
企业级SaaS CRM实现
Activity的创建和跳转
Chrome浏览器标签管理插件–OneTab
Break the cocoon | one article explains what is the real cloud primordial
BugkuCTF-web21(详细解题思路及步骤)
2837xd 代码生成——StateFlow(4)
道阻且长,行则将至
idea查看字节码配置
Who is better for Beijing software development? How to find someone to develop system software
Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)