justd0 发表于 2020-4-21 23:18

【LSM6DSOX的FSM有限状态机理解】--编程模块简介

本帖最后由 justd0 于 2020-4-22 09:52 编辑

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这一章开始,我将详细的分享下对</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">LSM6DSOX</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">中编程模块的理解,如果不了解</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">状态机是啥的小伙伴,请先阅读</span><a href="https://bbs.eeworld.com.cn/thread-1118911-1-1.html"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">LSM6DSOX的FSM有限状态机理解--状态机简介</span></a></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本章我将从FSM的编程模块到Unico FSM编程界面,分别介绍各个模块、区域、变量的意义,为编写自己FSM状态机程序打个基础,下面我们开始吧。</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://bbs.eeworld.com.cn/thread-1118911-1-1.html" target="_blank">上一帖</a>中介绍了</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">LSM6DSOX</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">中一共有</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">16</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">个完全独立</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">并</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">资源相同</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">状态机程序块</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,那么每个程序块长什么样子呢?</span></span></p>

<p style="margin-left: 120px;">&nbsp;</p>

<p></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一个状态机程序块中包含了<span style="font-weight:bold">输入选择器</span>和<span style="font-weight:bold">状态机代码块</span>两部分。</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="font-weight:bold">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;输入选择器</span>能够将传感器信号或者内部计算的数据信号中选择输入信号源,所支持的信号如下:</span></span></p>

<ul style="margin-left:36px; unicode-bidi:embed" type="disc">
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">LSM6DSOX</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">加速度计数据、加速度和</span></span>&nbsp; <span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">矢量的模。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">LSM6DSOX</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">陀螺仪角速度数据、角速度和</span></span> <span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">矢量的模。</span></span></li>
        <li style="vertical-align:middle"><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">外部传感器</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">(</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">比如磁力计</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">)</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">数据,磁力和</span></span> <span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">矢量的模。</span></span></li>
        <li style="vertical-align:middle"><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">内部计算的角度、角度和</span></span> <span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">矢量的模</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">(</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#a5a5a5">这是个什么量</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#a5a5a5">..</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">)</span></span></li>
        <li style="vertical-align:middle"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">正确配置的机器学习模块的输出。</span></span></li>
</ul>

<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">其中,上述空间物理量和 矢量的模计算方法如公式:</span></span></p>

<p style="margin-left: 160px;"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;"><img alt="V=\sqrt{x^{2}+y^{2}+z^{2}}" src="https://bbs.eeworld.com.cn/gif.latex?V%3D%5Csqrt%7Bx%5E%7B2%7D&amp;plus;y%5E%7B2%7D&amp;plus;z%5E%7B2%7D%7D" /></span></span></p>

<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">怎么</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">选择输入</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">FSM</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">信号源</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">呢?这里就涉及到了一个命令&ldquo;</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">SINMUX</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">&rdquo;,用这个命令就可以配置不同的数据到</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的数据源端了,具体用法我会在指令介绍中讲解</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">~</span></span></p>

<p lang="en-US"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="font-weight:bold">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;状态机代码块</span>就是我们实现自己状态机的功能模块了,如下图所示,状态机代码块由<span style="font-weight:bold">固定变量、可变变量、指令程序</span>组成:</span></span></p>

<p style="margin-left: 120px;">&nbsp;</p>

<p></p>

<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">固定变量区</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">位于程序块的最前端,长度固定</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">6</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">字节,</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">一共</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">6</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">个变量,根据配置系统自动更新,无需自己更改。</span></span></p>

<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">可变变量区</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">位于固定变量区之后,长度随使用而改变,最长</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">36</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">字节</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,一共</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">24</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">个变量,随用随设置。</span></span></p>

<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">指令程序区</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">位于可变变量区之后,由条件和命令组成,控制输入选择器的命令&ldquo;</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">SINMUX</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">&rdquo;就在这个区域内设置。</span></span></p>

<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">状态机代码块中的上述三个区域总长度</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">最多</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">256</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">字节。</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">每次上电时,需要</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">重新配置</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">FSM</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">代码块</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">内容</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">。</span></span></span></p>

<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">每个状态机代码块都可以根据输入的信号采样集数据,产生一个中断信号,并且修改相应的</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">FSM_OUTS</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">寄存器状态。</span></span></p>

<p style="margin-left: 40px;">&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">接下来结合</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nicoGUI</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">软件的</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">界面,介绍上述状态机程序块相关内容。</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">关于如何连接开发板和启动</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nicoGUI</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">软件,如果有问题可以参考 </span><a href="https://bbs.eeworld.com.cn/thread-1117573-1-1.html"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">LSM6DSOX开箱与体验&ldquo;Port not open &amp; not supported &rdquo;问题解决</span></a><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">。</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">这里默认大家都能正常打开</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">UnicoGUI</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">软件了哈。</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">在</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的主界面左侧,点开</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">模块,可以看到界面中一共有三个标签栏,</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Configuration</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Interrupt</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Debug</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">默认的界面就是状态机设置、编程的界面,如下图所示。</span></span></p>

<p style="margin-left: 80px;">&nbsp;</p>

<p style="margin-left: 40px;">&nbsp;</p>

<p></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">在这个界面中我们可以看到有很多的按键和输入框,参考</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">上</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">使用</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">.pdf</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">文件中,我标注了</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">8</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">个红框区域,逐一来看:</span></span></p>

<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">1</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">StateMachine Selection</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,状态机选择</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,这个下拉菜单中一共有</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">16</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">个选项,对应的就是前面讲的</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">16</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">个独立的状态机程序块</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">。</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">2</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">FSM_ODR,FSM</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">频率</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">(Output Data Rate)</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,这个值在限制了加速度</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">/</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">角速度数据传输到代码块的最高频率,建议是将加速度</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">/</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">角速度的输出频率高于这个值,也就是在</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">U</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">主界面的</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Opitions</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">中</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Accelerater output data rate</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">和</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Gyrocope Output data rate</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">值高于</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">FSM ODR</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的值,避免欠采样问题发生。</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">3</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">L</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">ong_Counter,</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">16</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">位计数器</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,一个最大可以计数</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">65535</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的全局计数器,也就是所有状态机程序块公用。</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">M</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">ax Value</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">是设置计数器的最大溢出值,</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">16</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">位数据形式标志(例如</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">65525</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">填写</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">FFFF)</span></span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">,</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">底下两个勾选可以设置计数器溢出时是否产生</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">INT1/INT2</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">外部中断。计数器的值可以从程序中使用&ldquo;</span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">INCR</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">&rdquo;来增加。</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">4</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">Converter,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">格式转换</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,由于</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">中用的都是半精度浮点数</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">HFP</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,所以在这给我们提供了</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">32</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">位浮点数转</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">16</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">位浮点数、</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">16</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">位转</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">32</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">位的小工具。</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">5</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">SM</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">x status,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">状态机</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">x</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">状态设置</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,这个区域有三个选项,</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">E</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nabled</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">用于</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">启动</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">状态机</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">x</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">只有勾选</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Enabled</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">该状态机程序块才会工作。</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">INT1 INT2</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">分别将状态机的中断</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">路由</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">到</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">INT1</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">、</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">INT2</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">外部中断上,</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">16</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">个状态机可以</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">独立设置启动与否</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,绑定外部中断。</span></span></p>

<p>&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">6</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">SM</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">x Fixed Data Section,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">状态机</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">x</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">固定变量区</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,显示了</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">6</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">个变量和</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">2</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">个开关:</span></span></p>

<ul style="unicode-bidi: embed;" type="disc">
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">C</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">onfigA</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">和</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">configB</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">中储存了程序所使用的的资源量</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">Size </span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">显示的是状态机</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">总的字节数</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,图中由于没有配置任何资源,所以显示的</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">6</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">字节为固定变量区大小。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">S</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">etting</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">中保存了当前程序状态,选择的掩码,选择的阈值,输入信号等等。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">Reset Pointer(RP)</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">复位点</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,储存了条件指令中返回判断</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">(RESET)</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">为真所跳转的地址。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">P</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">rogram Pointer(PP)</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">当前运行程序点,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">储存了当前采样时间内正在执行的指令的地址。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">H</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">ysteresis </span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">回滞变量</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">开关,启动该选项后,下方的</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">H</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">ysteresis</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">回滞变量可以设置。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">D</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">ecimation</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">降频变量</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">开关,启动该选项后,下方的</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">dest</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">降频变量可以设置。</span></span></li>
</ul>

<p style="vertical-align:middle">&nbsp;</p>

<p style="vertical-align:middle"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">上面的固定变量,在用UnicoGUI的时候这六个变量都是<span lang="zh-CN" style="font-weight:bold">跟随编程操作自动更改的,</span>无需自行更改。</span></span></p>

<p style="vertical-align:middle">&nbsp;</p>

<p style="vertical-align:middle"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">当我们想要直接使用</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">LSM6DSOX</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">在自己的项目中的时候,则需要考虑设置其中的值。</span></span></p>

<p style="vertical-align:middle">&nbsp;</p>

<p style="vertical-align:middle"><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">7</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">SM</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">x Variable Data Section,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">状态机</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">x</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">可变变量区</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">,其中显示了</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">24</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">个变量,共计</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">36</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">个字节,当我们用不到某些变量的时候,</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Unico</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">就不会配置该变量到状态机程序块中,也就不占用内存。</span></span></p>

<p style="margin-left:36px">&nbsp;</p>

<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">其中<span style="font-weight:bold">黑色字体</span>的就是可以设置的变量</span></span></p>

<ul style="margin-left: 40px; unicode-bidi: embed;" type="circle">
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">T</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">hresh1-3</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,阈值</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,在条件指令中,用来比较输入信号对应轴的数据是否到达阈值。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">H</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">ysteresis</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,回滞参数,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">当设置了回滞参数后,在对某轴进行阈值比较时,会将比较值增加回滞参数变成一个比较区间,如下图所示。</span></span></li>
</ul>

<p style="vertical-align: middle; margin-left: 120px;">&nbsp;</p>

<p style="vertical-align:middle"></p>

<ul style="margin-left: 40px; unicode-bidi: embed;" type="circle">
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">M</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">asksA-C</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,轴选择掩码</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,用于</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">指定输入数据的哪个轴</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">进行阈值条件或过零条件判断。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">T</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">imer1-3</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,定时器值</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,在条件指令中,设置的定时器比较的时间值。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">D</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">est</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,降频因子,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">用来降低状态机处理传感器数据的频率,将</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">该状态机</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">处理数据的频率降为</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">FSM ODR/Dest</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">。</span></span></li>
        <li style="vertical-align:middle"><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">Decision Tree,机器学习决策树接口,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">通过&ldquo;</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">CHKDT</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&rdquo;命令检查机器学习核心内部的决策树结果,当</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">FSM</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">和机器学习结合的时候就需要用到这个参数。</span></span></li>
</ul>

<p style="margin-left:36px">&nbsp;</p>

<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#bdc3c7;"><span style="font-weight:bold">灰色字体</span></span>的是没法直接设置的变量</span></span></p>

<ul style="margin-left: 40px; unicode-bidi: embed;" type="circle">
        <li style="vertical-align:middle"><span style="color:#bdc3c7;"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">T</span><span style="font-family:&quot;Microsoft YaHei&quot;">emporary MaskA-C</span></span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="color:#bdc3c7;"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,临时掩码</span></span></span><span style="font-family:&quot;Microsoft YaHei&quot;">,用来保存</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">MasksA-C</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">的复制值。</span></span></li>
        <li style="vertical-align:middle"><span style="color:#bdc3c7;"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">DX,DY,DZ,DV</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#bdc3c7;">三轴角度、角度和矢量的模</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">显示的是当前传感器角速度积分得到的角度值。</span></span></li>
        <li style="vertical-align:middle"><span style="color:#bdc3c7;"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">D</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">eltaT</span></span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#bdc3c7;">,角速度积分参数</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">角速度会乘上该值后积分乘角度值</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">。</span></span></span></li>
        <li style="vertical-align:middle"><span style="color:#bdc3c7;"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">PAS,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">Previous axis sign</span></span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#bdc3c7;">,上一个轴号</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">储存前一个采样的轴号,在零点交叉条件下使用</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">。</span></span></span></li>
        <li style="vertical-align:middle"><span style="color:#bdc3c7;"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">DESC</span></span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#bdc3c7;">,内部计数器</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">在降频时使用,由设备自动管理。</span></span></li>
        <li style="vertical-align:middle"><span style="color:#bdc3c7;"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">TC</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">Timer Counter</span></span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;"><span style="color:#bdc3c7;">,内部临时定时计数器</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">用于检测定时器是否过期。</span></span></li>
</ul>

<p style="vertical-align:middle"><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">8</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">SM</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">x Instructions Section,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">程序指令区,</span></span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">上图中这个区域只有四个按键,</span></span><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">分别是</span></span></p>

<ul>
        <li style="vertical-align: middle;"><span style="font-size:14.0pt"><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Add State </span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">增加状态指令</span></span></span></li>
        <li style="vertical-align: middle;"><span style="font-size:14.0pt"><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">I</span></span><span style="font-size:14.0pt"><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">mport State Machine</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">导入状态机指令</span></span></span></li>
        <li style="vertical-align: middle;"><span style="font-size:14.0pt"><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Export State Machine</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">导出状态机指令</span></span></span></li>
        <li style="vertical-align: middle;"><span style="font-size:14.0pt"><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">Reset State Machine</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">重置状态机指令</span></span></span></li>
</ul>

<p style="vertical-align:middle"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">当点击Add State按键后,就可以增加一条状态指令,如下图所示</span></span></p>

<p style="margin-left:36px"><span style="font-family: &quot;Microsoft YaHei&quot;; font-size: 14pt;">图中红框内容从左至右分别是:</span></p>

<ul style="margin-left: 40px; unicode-bidi: embed;" type="circle">
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">S0&nbsp; </span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">状态号</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,随着状态指令增加,状态号依次递增</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">0</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">x06 </span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">状态地址,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">也是随着状态指令增加而增长,</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">Reset Pointer(RP)</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">复位点和</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">P</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">rogram Pointer(PP)</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">当前运行程序点中的数据就是指这个地址,首状态地址随前面固定变量和可变变量总长度而定,图中由于只有</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">6</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">个固定长度,因此状态</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">S0</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">地址为</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">0x06</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">。</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">RNC</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">R</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">eset/Next conditions</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,选择该条状态为条件指令</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">CMD</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,Commands,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">选择该条状态为命令指令</span></span></li>
        <li style="vertical-align:middle"><span style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">指令选择框</span></span></span><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">,选择需要的指令</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">16</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">进制指令码,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">所选指令的</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:&quot;Times New Roman&quot;">16</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">进制形式</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">Add</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">增加状态按钮,在</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">此状态前</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">增加状态</span></span></li>
        <li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Times New Roman&quot;">R</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">emove</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:&quot;Microsoft YaHei&quot;">,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">删除状态按钮,删除此条状态。</span></span></li>
</ul>

<p style="vertical-align:middle">&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">在</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">模块的</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">I</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">nterrupt</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">界面下,分成了两个区域,如图所示。</span></span></p>

<p>&nbsp;</p>

<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">左侧为输入加速度、角速度、输出外部中断INT1/INT2的波形图。</span></span></p>

<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">右侧为16个状态机的输出寄存器OUT_Sx的数据,通过点击read,可以读取当前的值。</span></span></p>

<p style="margin-left:36px">&nbsp;</p>

<p style="margin-left:36px"></p>

<p style="margin-left:36px">&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">在</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">模块的</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">D</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">ebug</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">界面下,也是分成了两个区域,如下图所示。</span></span></p>

<p>&nbsp;</p>

<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">左侧为我们写的状态机图,通过分析它可以很清楚的看到我们的状态机状态是如何改变的。</span></span></p>

<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">右侧为调试区域,通过导入采集的输入数据集,可以对左边的状态机进行仿真调试,这里就先不细说了。</span></span></p>

<p style="margin-left:36px">&nbsp;</p>

<p style="margin-left:36px"></p>

<p style="margin-left:36px">&nbsp;</p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">以上就是对</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">LSM6DSOX</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">中</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">编程模块各个模块和参数的基础认识,对这些有了初步的认识和了解之后,我们就可以着手看看示例状态机程序,分析下其工作流程和编写流程了</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">~</span></span></p>

<p lang="en-US"><span style="font-size:14.0pt"><span style="font-family:&quot;Microsoft YaHei&quot;">&nbsp;</span></span></p>

<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">下一章</span> <span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">将从示例程序,对</span><span lang="en-US" style="font-family:&quot;Times New Roman&quot;">LSM6DSOX</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">的</span><span lang="en-US" style="font-family:&quot;Microsoft YaHei&quot;">FSM</span><span lang="zh-CN" style="font-family:&quot;Microsoft YaHei&quot;">编程过程进行分析讲解。</span></span></p>

littleshrimp 发表于 2020-4-22 08:00

<p>很好的贴子,标题和内部型号是不是写错了?LSM6DSOX?</p>

nmg 发表于 2020-4-22 08:55

littleshrimp 发表于 2020-4-22 08:00
很好的贴子,标题和内部型号是不是写错了?LSM6DSOX?

<p><img height="28" src="https://bbs.eeworld.com.cn/static/editor/plugins/hkemoji/sticker/facebook/grinning-face-with-smiling-eyes_1f601.png" width="28" />沟通后,帮他改了,哈哈</p>

littleshrimp 发表于 2020-4-22 09:45

nmg 发表于 2020-4-22 08:55
沟通后,帮他改了,哈哈

<p>&quot;LSMC6DSOX&quot;</p>

<p>LSM6DSOX</p>

justd0 发表于 2020-4-22 09:53

littleshrimp 发表于 2020-4-22 09:45
&quot;LSMC6DSOX&quot;

LSM6DSOX

<p>感谢指正哈,已经修改过来啦<img height="28" src="https://bbs.eeworld.com.cn/static/editor/plugins/hkemoji/sticker/facebook/smiling-face-with-open-mouth_1f603.png" width="28" /></p>

wushuisheng 发表于 2020-4-29 11:17

<p>本贴不错,顶一下</p>

<p>&nbsp;</p>

kinggate1 发表于 2021-7-24 00:54

<p>感谢分享</p>
页: [1]
查看完整版本: 【LSM6DSOX的FSM有限状态机理解】--编程模块简介