【LSM6DSOX的FSM有限状态机理解】--编程模块简介
本帖最后由 justd0 于 2020-4-22 09:52 编辑<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei""> 这一章开始,我将详细的分享下对</span><span lang="en-US" style="font-family:"Times New Roman"">LSM6DSOX</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的</span><span lang="en-US" style="font-family:"Times New Roman"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">中编程模块的理解,如果不了解</span><span lang="en-US" style="font-family:"Times New Roman"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">状态机是啥的小伙伴,请先阅读</span><a href="https://bbs.eeworld.com.cn/thread-1118911-1-1.html"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">LSM6DSOX的FSM有限状态机理解--状态机简介</span></a></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""> 本章我将从FSM的编程模块到Unico FSM编程界面,分别介绍各个模块、区域、变量的意义,为编写自己FSM状态机程序打个基础,下面我们开始吧。</span></span></p>
<p><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei""> <a href="https://bbs.eeworld.com.cn/thread-1118911-1-1.html" target="_blank">上一帖</a>中介绍了</span><span lang="en-US" style="font-family:"Times New Roman"">LSM6DSOX</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的</span><span lang="en-US" style="font-family:"Times New Roman"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">中一共有</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">16</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">个完全独立</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">并</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">资源相同</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">状态机程序块</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,那么每个程序块长什么样子呢?</span></span></p>
<p style="margin-left: 120px;"> </p>
<p></p>
<p><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""> 一个状态机程序块中包含了<span style="font-weight:bold">输入选择器</span>和<span style="font-weight:bold">状态机代码块</span>两部分。</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""><span style="font-weight:bold"> 输入选择器</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:"Times New Roman"">LSM6DSOX</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">加速度计数据、加速度和</span></span> <span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">矢量的模。</span></span></li>
<li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Times New Roman"">LSM6DSOX</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">陀螺仪角速度数据、角速度和</span></span> <span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">矢量的模。</span></span></li>
<li style="vertical-align:middle"><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">外部传感器</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Times New Roman"">(</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">比如磁力计</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Times New Roman"">)</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">数据,磁力和</span></span> <span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">矢量的模。</span></span></li>
<li style="vertical-align:middle"><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">内部计算的角度、角度和</span></span> <span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">矢量的模</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">(</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""><span style="color:#a5a5a5">这是个什么量</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""><span style="color:#a5a5a5">..</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">)</span></span></li>
<li style="vertical-align:middle"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">正确配置的机器学习模块的输出。</span></span></li>
</ul>
<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">其中,上述空间物理量和 矢量的模计算方法如公式:</span></span></p>
<p style="margin-left: 160px;"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""><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&plus;y%5E%7B2%7D&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:"Microsoft YaHei"">怎么</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">选择输入</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">FSM</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">信号源</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">呢?这里就涉及到了一个命令“</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">SINMUX</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">”,用这个命令就可以配置不同的数据到</span><span lang="en-US" style="font-family:"Times New Roman"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的数据源端了,具体用法我会在指令介绍中讲解</span><span lang="en-US" style="font-family:"Microsoft YaHei"">~</span></span></p>
<p lang="en-US"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""><span style="font-weight:bold"> 状态机代码块</span>就是我们实现自己状态机的功能模块了,如下图所示,状态机代码块由<span style="font-weight:bold">固定变量、可变变量、指令程序</span>组成:</span></span></p>
<p style="margin-left: 120px;"> </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:"Microsoft YaHei"">固定变量区</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">位于程序块的最前端,长度固定</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">6</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">字节,</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">一共</span><span lang="en-US" style="font-family:"Times New Roman"">6</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">个变量,根据配置系统自动更新,无需自己更改。</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:"Microsoft YaHei"">可变变量区</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">位于固定变量区之后,长度随使用而改变,最长</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">36</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">字节</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,一共</span><span lang="en-US" style="font-family:"Times New Roman"">24</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">个变量,随用随设置。</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:"Microsoft YaHei"">指令程序区</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">位于可变变量区之后,由条件和命令组成,控制输入选择器的命令“</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">SINMUX</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">”就在这个区域内设置。</span></span></p>
<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">状态机代码块中的上述三个区域总长度</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">最多</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">256</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">字节。</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">每次上电时,需要</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">重新配置</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">FSM</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">代码块</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">内容</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">。</span></span></span></p>
<p style="margin-left: 40px;"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">每个状态机代码块都可以根据输入的信号采样集数据,产生一个中断信号,并且修改相应的</span><span lang="en-US" style="font-family:"Times New Roman"">FSM_OUTS</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">寄存器状态。</span></span></p>
<p style="margin-left: 40px;"> </p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">接下来结合</span><span lang="en-US" style="font-family:"Times New Roman"">U</span><span lang="en-US" style="font-family:"Microsoft YaHei"">nicoGUI</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">软件的</span><span lang="en-US" style="font-family:"Microsoft YaHei"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">界面,介绍上述状态机程序块相关内容。</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">关于如何连接开发板和启动</span><span lang="en-US" style="font-family:"Times New Roman"">U</span><span lang="en-US" style="font-family:"Microsoft YaHei"">nicoGUI</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">软件,如果有问题可以参考 </span><a href="https://bbs.eeworld.com.cn/thread-1117573-1-1.html"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">LSM6DSOX开箱与体验“Port not open & not supported ”问题解决</span></a><span lang="zh-CN" style="font-family:"Microsoft YaHei"">。</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">这里默认大家都能正常打开</span><span lang="en-US" style="font-family:"Microsoft YaHei"">UnicoGUI</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">软件了哈。</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">在</span><span lang="en-US" style="font-family:"Times New Roman"">U</span><span lang="en-US" style="font-family:"Microsoft YaHei"">nico</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的主界面左侧,点开</span><span lang="en-US" style="font-family:"Microsoft YaHei"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">模块,可以看到界面中一共有三个标签栏,</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Configuration</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Interrupt</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Debug</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">默认的界面就是状态机设置、编程的界面,如下图所示。</span></span></p>
<p style="margin-left: 80px;"> </p>
<p style="margin-left: 40px;"> </p>
<p></p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">在这个界面中我们可以看到有很多的按键和输入框,参考</span><span lang="en-US" style="font-family:"Times New Roman"">U</span><span lang="en-US" style="font-family:"Microsoft YaHei"">nico</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">上</span><span lang="en-US" style="font-family:"Microsoft YaHei"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">使用</span><span lang="en-US" style="font-family:"Microsoft YaHei"">.pdf</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">文件中,我标注了</span><span lang="en-US" style="font-family:"Microsoft YaHei"">8</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">个红框区域,逐一来看:</span></span></p>
<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">1</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">StateMachine Selection</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,状态机选择</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,这个下拉菜单中一共有</span><span lang="en-US" style="font-family:"Times New Roman"">16</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">个选项,对应的就是前面讲的</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">16</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">个独立的状态机程序块</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">。</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">2</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">FSM_ODR,FSM</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">频率</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">(Output Data Rate)</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,这个值在限制了加速度</span><span lang="en-US" style="font-family:"Times New Roman"">/</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">角速度数据传输到代码块的最高频率,建议是将加速度</span><span lang="en-US" style="font-family:"Times New Roman"">/</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">角速度的输出频率高于这个值,也就是在</span><span lang="en-US" style="font-family:"Times New Roman"">U</span><span lang="en-US" style="font-family:"Microsoft YaHei"">nico</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">主界面的</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Opitions</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">中</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Accelerater output data rate</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">和</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Gyrocope Output data rate</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">值高于</span><span lang="en-US" style="font-family:"Microsoft YaHei"">FSM ODR</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的值,避免欠采样问题发生。</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">3</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">L</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">ong_Counter,</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">16</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">位计数器</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,一个最大可以计数</span><span lang="en-US" style="font-family:"Times New Roman"">65535</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的全局计数器,也就是所有状态机程序块公用。</span><span lang="en-US" style="font-family:"Times New Roman"">M</span><span lang="en-US" style="font-family:"Microsoft YaHei"">ax Value</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">是设置计数器的最大溢出值,</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">16</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">位数据形式标志(例如</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">65525</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">填写</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">FFFF)</span></span><span lang="en-US" style="font-family:"Microsoft YaHei"">,</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">底下两个勾选可以设置计数器溢出时是否产生</span><span lang="en-US" style="font-family:"Microsoft YaHei"">INT1/INT2</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">外部中断。计数器的值可以从程序中使用“</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">INCR</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">”来增加。</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">4</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">Converter,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">格式转换</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,由于</span><span lang="en-US" style="font-family:"Times New Roman"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">中用的都是半精度浮点数</span><span lang="en-US" style="font-family:"Times New Roman"">HFP</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,所以在这给我们提供了</span><span lang="en-US" style="font-family:"Times New Roman"">32</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">位浮点数转</span><span lang="en-US" style="font-family:"Times New Roman"">16</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">位浮点数、</span><span lang="en-US" style="font-family:"Times New Roman"">16</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">位转</span><span lang="en-US" style="font-family:"Times New Roman"">32</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">位的小工具。</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">5</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">SM</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">x status,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">状态机</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">x</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">状态设置</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,这个区域有三个选项,</span><span lang="en-US" style="font-family:"Times New Roman"">E</span><span lang="en-US" style="font-family:"Microsoft YaHei"">nabled</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">用于</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">启动</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">状态机</span><span lang="en-US" style="font-family:"Microsoft YaHei"">x</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">只有勾选</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Enabled</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">该状态机程序块才会工作。</span><span lang="en-US" style="font-family:"Microsoft YaHei"">INT1 INT2</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">分别将状态机的中断</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">路由</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">到</span><span lang="en-US" style="font-family:"Microsoft YaHei"">INT1</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">、</span><span lang="en-US" style="font-family:"Microsoft YaHei"">INT2</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">外部中断上,</span><span lang="en-US" style="font-family:"Microsoft YaHei"">16</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">个状态机可以</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">独立设置启动与否</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,绑定外部中断。</span></span></p>
<p> </p>
<p><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">6</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">SM</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">x Fixed Data Section,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">状态机</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">x</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">固定变量区</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,显示了</span><span lang="en-US" style="font-family:"Microsoft YaHei"">6</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">个变量和</span><span lang="en-US" style="font-family:"Microsoft YaHei"">2</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">个开关:</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:"Times New Roman"">C</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">onfigA</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">和</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">configB</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">中储存了程序所使用的的资源量</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:"Microsoft YaHei"">Size </span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">显示的是状态机</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">总的字节数</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,图中由于没有配置任何资源,所以显示的</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">6</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">字节为固定变量区大小。</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:"Times New Roman"">S</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">etting</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">中保存了当前程序状态,选择的掩码,选择的阈值,输入信号等等。</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:"Microsoft YaHei"">Reset Pointer(RP)</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">复位点</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,储存了条件指令中返回判断</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">(RESET)</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">为真所跳转的地址。</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:"Times New Roman"">P</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">rogram Pointer(PP)</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">当前运行程序点,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">储存了当前采样时间内正在执行的指令的地址。</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:"Times New Roman"">H</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">ysteresis </span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">回滞变量</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">开关,启动该选项后,下方的</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">H</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">ysteresis</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">回滞变量可以设置。</span></span></li>
<li style="vertical-align:middle"><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Times New Roman"">D</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">ecimation</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">降频变量</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">开关,启动该选项后,下方的</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">dest</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">降频变量可以设置。</span></span></li>
</ul>
<p style="vertical-align:middle"> </p>
<p style="vertical-align:middle"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">上面的固定变量,在用UnicoGUI的时候这六个变量都是<span lang="zh-CN" style="font-weight:bold">跟随编程操作自动更改的,</span>无需自行更改。</span></span></p>
<p style="vertical-align:middle"> </p>
<p style="vertical-align:middle"><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">当我们想要直接使用</span><span lang="en-US" style="font-family:"Times New Roman"">LSM6DSOX</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">在自己的项目中的时候,则需要考虑设置其中的值。</span></span></p>
<p style="vertical-align:middle"> </p>
<p style="vertical-align:middle"><span style="font-size:14.0pt"><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">7</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">SM</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">x Variable Data Section,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">状态机</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">x</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">可变变量区</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,其中显示了</span><span lang="en-US" style="font-family:"Microsoft YaHei"">24</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">个变量,共计</span><span lang="en-US" style="font-family:"Microsoft YaHei"">36</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">个字节,当我们用不到某些变量的时候,</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Unico</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">就不会配置该变量到状态机程序块中,也就不占用内存。</span></span></p>
<p style="margin-left:36px"> </p>
<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">其中<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:"Times New Roman"">T</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">hresh1-3</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,阈值</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,在条件指令中,用来比较输入信号对应轴的数据是否到达阈值。</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:"Times New Roman"">H</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">ysteresis</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,回滞参数,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">当设置了回滞参数后,在对某轴进行阈值比较时,会将比较值增加回滞参数变成一个比较区间,如下图所示。</span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"> </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:"Times New Roman"">M</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">asksA-C</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,轴选择掩码</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,用于</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">指定输入数据的哪个轴</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">进行阈值条件或过零条件判断。</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:"Times New Roman"">T</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">imer1-3</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,定时器值</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,在条件指令中,设置的定时器比较的时间值。</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:"Times New Roman"">D</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">est</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,降频因子,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">用来降低状态机处理传感器数据的频率,将</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">该状态机</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">处理数据的频率降为</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">FSM ODR/Dest</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">。</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:"Microsoft YaHei"">Decision Tree,机器学习决策树接口,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">通过“</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">CHKDT</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">”命令检查机器学习核心内部的决策树结果,当</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">FSM</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">和机器学习结合的时候就需要用到这个参数。</span></span></li>
</ul>
<p style="margin-left:36px"> </p>
<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""><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:"Times New Roman"">T</span><span style="font-family:"Microsoft YaHei"">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:"Microsoft YaHei"">,临时掩码</span></span></span><span style="font-family:"Microsoft YaHei"">,用来保存</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">MasksA-C</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">的复制值。</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:"Times New Roman"">DX,DY,DZ,DV</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei""><span style="color:#bdc3c7;">三轴角度、角度和矢量的模</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">显示的是当前传感器角速度积分得到的角度值。</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:"Times New Roman"">D</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">eltaT</span></span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei""><span style="color:#bdc3c7;">,角速度积分参数</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">角速度会乘上该值后积分乘角度值</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">。</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:"Times New Roman"">PAS,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">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:"Microsoft YaHei""><span style="color:#bdc3c7;">,上一个轴号</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">储存前一个采样的轴号,在零点交叉条件下使用</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">。</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:"Times New Roman"">DESC</span></span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei""><span style="color:#bdc3c7;">,内部计数器</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">在降频时使用,由设备自动管理。</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:"Times New Roman"">TC</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">Timer Counter</span></span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei""><span style="color:#bdc3c7;">,内部临时定时计数器</span>,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">用于检测定时器是否过期。</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:"Times New Roman"">8</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">、</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">SM</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">x Instructions Section,</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">程序指令区,</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">上图中这个区域只有四个按键,</span></span><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">分别是</span></span></p>
<ul>
<li style="vertical-align: middle;"><span style="font-size:14.0pt"><span lang="en-US" style="font-family:"Microsoft YaHei"">Add State </span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">增加状态指令</span></span></span></li>
<li style="vertical-align: middle;"><span style="font-size:14.0pt"><span lang="en-US" style="font-family:"Microsoft YaHei"">I</span></span><span style="font-size:14.0pt"><span lang="en-US" style="font-family:"Microsoft YaHei"">mport State Machine</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">导入状态机指令</span></span></span></li>
<li style="vertical-align: middle;"><span style="font-size:14.0pt"><span lang="en-US" style="font-family:"Microsoft YaHei"">Export State Machine</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">导出状态机指令</span></span></span></li>
<li style="vertical-align: middle;"><span style="font-size:14.0pt"><span lang="en-US" style="font-family:"Microsoft YaHei"">Reset State Machine</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">重置状态机指令</span></span></span></li>
</ul>
<p style="vertical-align:middle"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">当点击Add State按键后,就可以增加一条状态指令,如下图所示</span></span></p>
<p style="margin-left:36px"><span style="font-family: "Microsoft YaHei"; 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:"Times New Roman"">S0 </span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">状态号</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,随着状态指令增加,状态号依次递增</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:"Times New Roman"">0</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">x06 </span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">状态地址,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">也是随着状态指令增加而增长,</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">Reset Pointer(RP)</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">复位点和</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Times New Roman"">P</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">rogram Pointer(PP)</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">当前运行程序点中的数据就是指这个地址,首状态地址随前面固定变量和可变变量总长度而定,图中由于只有</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">6</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">个固定长度,因此状态</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">S0</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">地址为</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">0x06</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">。</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:"Times New Roman"">RNC</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">R</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">eset/Next conditions</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,选择该条状态为条件指令</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:"Times New Roman"">CMD</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,Commands,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">选择该条状态为命令指令</span></span></li>
<li style="vertical-align:middle"><span style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">指令选择框</span></span></span><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">,选择需要的指令</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:"Times New Roman"">16</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">进制指令码,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">所选指令的</span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-family:"Times New Roman"">16</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">进制形式</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:"Microsoft YaHei"">Add</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">增加状态按钮,在</span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">此状态前</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">增加状态</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:"Times New Roman"">R</span></span></span><span lang="en-US" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">emove</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="zh-CN" style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">删除状态按钮,删除此条状态。</span></span></li>
</ul>
<p style="vertical-align:middle"> </p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">在</span><span lang="en-US" style="font-family:"Times New Roman"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">模块的</span><span lang="en-US" style="font-family:"Times New Roman"">I</span><span lang="en-US" style="font-family:"Microsoft YaHei"">nterrupt</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">界面下,分成了两个区域,如图所示。</span></span></p>
<p> </p>
<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">左侧为输入加速度、角速度、输出外部中断INT1/INT2的波形图。</span></span></p>
<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">右侧为16个状态机的输出寄存器OUT_Sx的数据,通过点击read,可以读取当前的值。</span></span></p>
<p style="margin-left:36px"> </p>
<p style="margin-left:36px"></p>
<p style="margin-left:36px"> </p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">在</span><span lang="en-US" style="font-family:"Times New Roman"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">模块的</span><span lang="en-US" style="font-family:"Times New Roman"">D</span><span lang="en-US" style="font-family:"Microsoft YaHei"">ebug</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">界面下,也是分成了两个区域,如下图所示。</span></span></p>
<p> </p>
<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">左侧为我们写的状态机图,通过分析它可以很清楚的看到我们的状态机状态是如何改变的。</span></span></p>
<p style="margin-left:36px"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei"">右侧为调试区域,通过导入采集的输入数据集,可以对左边的状态机进行仿真调试,这里就先不细说了。</span></span></p>
<p style="margin-left:36px"> </p>
<p style="margin-left:36px"></p>
<p style="margin-left:36px"> </p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">以上就是对</span><span lang="en-US" style="font-family:"Times New Roman"">LSM6DSOX</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">中</span><span lang="en-US" style="font-family:"Times New Roman"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">编程模块各个模块和参数的基础认识,对这些有了初步的认识和了解之后,我们就可以着手看看示例状态机程序,分析下其工作流程和编写流程了</span><span lang="en-US" style="font-family:"Microsoft YaHei"">~</span></span></p>
<p lang="en-US"><span style="font-size:14.0pt"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:14.0pt"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">下一章</span> <span lang="zh-CN" style="font-family:"Microsoft YaHei"">将从示例程序,对</span><span lang="en-US" style="font-family:"Times New Roman"">LSM6DSOX</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的</span><span lang="en-US" style="font-family:"Microsoft YaHei"">FSM</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">编程过程进行分析讲解。</span></span></p>
<p>很好的贴子,标题和内部型号是不是写错了?LSM6DSOX?</p>
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>
nmg 发表于 2020-4-22 08:55
沟通后,帮他改了,哈哈
<p>"LSMC6DSOX"</p>
<p>LSM6DSOX</p>
littleshrimp 发表于 2020-4-22 09:45
"LSMC6DSOX"
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>
<p>本贴不错,顶一下</p>
<p> </p>
<p>感谢分享</p>
页:
[1]