【LSM6DSOX有限状态机例程学习 二】--有限状态机编程使用方法
<div style="border-width:100%"><div style="width:9.5972in">
<div style="width:9.5972in">
<p><span style="font-size:16px;"><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> </p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">本章我将从FSM的编程模块到Unico FSM编程界面,分别介绍各个模块、</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">区域、变量的意义,为编写自己FSM状态机程序打个基础,下面我们开始吧。</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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-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><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">那么每个程序块长什么样子呢?</span></span></p>
<p><span style="font-size:16px;"></span></p>
<p><span style="font-size:16px;"><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:16px;"><span style="font-family:"Microsoft YaHei""><span style="font-weight:bold">输入选择器</span>能够将传感器信号或者内部计算的数据信号中选择输入信号源,</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">所支持的信号如下:</span></span></p>
<ul style="margin-left:36px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-family:"Times New Roman"">LSM6DSOX</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">加速度计数据、加速度和</span></span> <span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">矢量的模。</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-family:"Times New Roman"">LSM6DSOX</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">陀螺仪角速度数据、角速度和</span></span> <span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">矢量的模。</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">外部传感器</span></span><span lang="en-US"><span style="font-family:"Times New Roman"">(</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">比如磁力计</span></span><span lang="en-US"><span style="font-family:"Times New Roman"">)</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">数据,磁力和</span></span> <span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">矢量的模。</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">内部计算的角度、角度和</span></span> <span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">角度矢量和</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">正确配置的机器学习模块的输出。</span></span></li>
</ul>
<p style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">其中,上述空间物理量和 矢量的模计算方法如公式:</span></span></p>
<p><span style="font-size:16px;"></span></p>
<p> </p>
<p><span style="font-size:16px;"><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></p>
<p><span style="font-size:16px;"><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="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 lang="en-US"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""><span style="font-weight:bold">状态机代码块</span>就是我们实现自己状态机的功能模块了,如下图所示,状态机代码块</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">由<span style="font-weight:bold">固定变量、可变变量、指令程序</span>组成:</span></span></p>
<p><span style="font-size:16px;"></span></p>
<p><span style="font-size:16px;"><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><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">自动更新,无需自己更改。</span></span></p>
<p><span style="font-size:16px;"><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><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">随用随设置。</span></span></p>
<p><span style="font-size:16px;"><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><span style="font-size:16px;"><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><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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></p>
<p><span style="font-size:16px;"><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> </p>
<p><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">每个状态机代码块都可以根据输入的信号采样集数据,产生一个中断信号,</span></span></p>
<p><span style="font-size:16px;"><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><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"> <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><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">算法逻辑的状态组成。</span></span></p>
<p> </p>
<p><span style="font-size:16px;"> <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"">8</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"">(CMD)</span></span></span></p>
<p><span style="font-size:16px;"><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"">RESET/NEXT,RNC</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></p>
<p><span style="font-size:16px;"><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></p>
<ul style="margin-left:36px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">命令指令</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">(CMD)</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">用于执行</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">流控制</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">、</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">输出</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">和</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">同步</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">等特殊任务</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">有的</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">命令</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 80px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">会需要参数,参数会作为一个单独的指令来执行,后面详细讲。</span></span></span></p>
<ul style="margin-left:36px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">条件指令(</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">RESET/NEXT,RNC</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">)</span></span></span><span lang="en-US"><span style="font-family:"Times New Roman"">,</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">由</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">两个条件</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">组合在一起(</span></span><span lang="en-US"><span style="font-family:"Times New Roman"">4</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">位的</span></span><span lang="en-US"><span style="font-family:"Times New Roman"">RESET</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 80px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">条件和</span></span><span lang="en-US"><span style="font-family:"Times New Roman"">4</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">位的</span></span><span lang="en-US"><span style="font-family:"Times New Roman"">NEXT</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">条件),用来复位或者继续执行程序流。</span></span></span></p>
<p><span style="font-size:16px;"> <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"">LSM6DSOX</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></p>
<p><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">还可以产生额外的功能,比如更新状态信息等,下面分别介绍下命令指令和</span></span></p>
<p><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">条件指令的特点和使用方法。</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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"">(CMD)</span></span></span></p>
<p lang="en-US"><span style="font-size:16px;"><span style="font-family:"Times New Roman""> </span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">命令指令是修改状态机行为中的<span style="font-weight:bold">流控制、输出</span>、和<span style="font-weight:bold">同步</span>的行为。</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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-family:"Times New Roman"">(</span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">不需要更新输入采样集</span></span><span lang="en-US" style="font-family:"Times New Roman"">)</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"">(PP)</span></span></span></p>
<p><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">被设置为下一行,将执行如下动作:</span></span></p>
<ul style="margin-left:36px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">如果新的一行是一个</span><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">命令指令</span></span><span style="font-family:"Microsoft YaHei"">,则</span><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">立即执行</span></span><span style="font-family:"Microsoft YaHei"">此行命令。</span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">如果新的一行是一个</span><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">条件指令</span></span><span style="font-family:"Microsoft YaHei"">,则在</span><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">下一个输入采样值到来</span></span><span style="font-family:"Microsoft YaHei"">之时,</span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">处理此行条件判断指令。</span></span></li>
</ul>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">有些命令指令可能会需要<span style="font-weight:bold">参数</span>,需要的参数必须在命令指令<span style="font-weight:bold">下一行定义</span>。</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">这里用</span><span lang="en-US" style="font-family:"Times New Roman"">"</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">STHR1</span></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"">1(THRESH1)</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的值,</span></span></p>
<p><span style="font-size:16px;"><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></p>
<p><span style="font-size:16px;"></span></p>
<p><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">当程序指针</span><span lang="en-US" style="font-family:"Times New Roman"">(PP)</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">指向状态</span><span lang="en-US" style="font-family:"Microsoft YaHei"">S0</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的</span><span lang="en-US" style="font-family:"Times New Roman"">0</span><span lang="en-US" style="font-family:"Microsoft YaHei"">x0A</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">地址时,设备识别出</span><span lang="en-US" style="font-family:"Microsoft YaHei"">"0xAA"</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">指令码为</span><span lang="en-US" style="font-family:"Times New Roman"">"</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">STHR1</span></span><span lang="en-US" style="font-family:"Times New Roman"">"</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">命令。</span></span></p>
<p><span style="font-size:16px;"><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="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">S0-S2</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><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">执行后阈值</span><span lang="en-US" style="font-family:"Times New Roman"">1</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的值将被设置为“</span><span lang="en-US" style="font-family:"Times New Roman"">0x5640</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">”即小数“</span><span lang="en-US" style="font-family:"Times New Roman"">100.0</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">”</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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"">RESET/NEXT,RNC</span></span><span lang="zh-CN" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">)</span></span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">条件指令用于<span style="font-weight:bold">重置</span>或者<span style="font-weight:bold">继续</span>程序流,条件指令在<span style="font-weight:bold">一个新的输入采样集准备好</span>后,</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">在一个<span style="font-weight:bold">单一状态</span>下执行。</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">条件指令中用于重置判断的RESET条件定义在操作码的高4位,而用于判断继续的</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">NEXT指令定义在操作码的低4位,条件指令的执行逻辑如下图所示:</span></span></p>
<p><span style="font-size:16px;"></span></p>
<p><span style="font-size:16px;"><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:"Times New Roman"">(RESET)</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,只有在</span><span lang="en-US" style="font-family:"Times New Roman"">RESET</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><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">才判断继续条件</span><span lang="en-US" style="font-family:"Times New Roman"">(NEXT)</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">。</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">当两个条件<span style="font-weight:bold">均不满足</span>时,状态机会<span style="font-weight:bold">等待一个新的采样集</span>到来,然后<span style="font-weight:bold">重新开始</span>判断。</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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"">RESET</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="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">PP=PR</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">。</span></span></p>
<p><span style="font-size:16px;"><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"">RESET</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"">NEXT</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="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">PP = PP+1</span></span><span lang="en-US" style="font-family:"Times New Roman"">;</span></span></p>
<p lang="en-US"><span style="font-size:16px;"><span style="font-family:"Times New Roman""> </span></span></p>
<p><span style="font-size:16px;"><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"">(RP)</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="en-US" style="font-family:"Times New Roman"">"</span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">SRP/CRP</span></span><span lang="en-US" style="font-family:"Times New Roman"">"</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><span style="font-size:16px;"><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><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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"">RESET</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"">NEXT</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><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">条件指令能够判断的条件一共有三种:</span></span></p>
<ul style="margin-left:36px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">超时</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">:当设置了定时器,定时计数器</span></span><span lang="en-US"><span style="font-family:"Times New Roman"">TC</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">的值达到</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">零</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">的时候,条件满足,成立。</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">阈值比较</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">:当启动的输入值</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">高于</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">(</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">或低于</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">)</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">设定的阈值时,条件满足,成立。</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">过零检测</span></span><span style="font-family:"Microsoft YaHei"">:当启动的输入</span><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">越过零位</span></span><span style="font-family:"Microsoft YaHei"">时,条件满足,成立。</span></span></li>
</ul>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">以上就是命令指令和条件指令的所有特点了。</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">35</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><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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="en-US" style="font-weight:bold"><span style="font-family:"Times New Roman"">PDF</span></span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">,共享给大家使用。</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p lang="en-US"><span style="font-size:16px;"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">U</span><span style="font-family:"Microsoft YaHei"">nicoGUI</span></span></span></p>
<p lang="en-US"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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"">ST</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">很贴心的出了一款</span></span></p>
<p><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">上位机</span><span lang="en-US" 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"">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><span style="font-size:16px;"><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"">U</span></span><span lang="en-US" style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">nicoGUI</span></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><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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开</span></a></span></p>
<p><span style="font-size:16px;"><a href="https://bbs.eeworld.com.cn/thread-1117573-1-1.html"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">箱与体验“Port not open & not supported ”问题解决</span></a><span lang="zh-CN" style="font-family:"Microsoft YaHei"">。这里默认大家都能</span></span></p>
<p><span style="font-size:16px;"><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><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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></p>
<p><span style="font-size:16px;"><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><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">默认的界面就是状态机设置、编程的界面,如下图所示。</span></span></p>
<p><span style="font-size:16px;"></span></p>
<p><span style="font-size:16px;"><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></p>
<p><span style="font-size:16px;"><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 style="margin-left:36px"><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">的就是</span></span><span style="font-size:16px;"><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 style="margin-left:36px"><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">传输到</span></span><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><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><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><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><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">避免欠采样问题发生。</span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">所有状态机程序块</span></span><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">公用。</span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">底下</span></span><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">计数器的值可以从程序中使用</span></span><span style="font-size:16px;"><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 style="margin-left:36px"><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><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><span style="font-size:16px;"><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 style="margin-left:36px"><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">只有勾选</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Enabled</span></span><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><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><span style="font-size:16px;"><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:36px"><span style="font-size:16px;"><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="margin-left:108px; unicode-bidi:embed" type="disc">
<li style="vertical-align: middle;"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">C</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">onfigA</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">和</span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">configB</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">中储存了程序所使用的的资源量</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">Size </span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">显示的是状态机</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">总的字节数</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,图中由于没有配置任何资源,</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 160px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">所以显示的</span></span></span><span style="font-size:16px;"><span lang="en-US"><span style="font-family:"Microsoft YaHei"">6</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">字节为固定变量区大小。</span></span></span></p>
<ul style="margin-left:108px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">S</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">etting</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">中保存了当前程序状态,选择的掩码,选择的阈值,输入</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 160px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">信号等等。</span></span></span></p>
<ul style="margin-left:108px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">Reset Pointer(RP)</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">复位点</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,储存了条件指令中返回判断</span></span><span lang="en-US"><span style="font-family:"Microsoft YaHei"">(RESET)</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 160px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">为真所跳转的地址。</span></span></span></p>
<ul style="margin-left:108px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">P</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">rogram Pointer(PP)</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">当前运行程序点,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">储存了当前采样时间内</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 160px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">正在执行的指令的地址。</span></span></span></p>
<ul style="margin-left:108px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">H</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">ysteresis </span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">回滞变量</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">开关,启动该选项后,下方的</span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">H</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">ysteresis</span></span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 160px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">回滞变量可以设置。</span></span></span></p>
<ul style="margin-left:108px; unicode-bidi:embed" type="disc">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">D</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">ecimation</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">降频变量</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">开关,启动该选项后,下方的</span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">dest</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">降频变量</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 160px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">可以设置。</span></span></span></p>
<p style="margin-left:72px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">上面的固定变量,在用UnicoGUI的时候这六个变量都是<span lang="zh-CN" style="font-weight:bold">跟随编程操作自动更改的,</span></span></span></p>
<p style="margin-left:72px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">无需自行更改。</span></span></p>
<p style="margin-left:72px"><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">当我们想要直接使用</span><span lang="en-US" style="font-family:"Times New Roman"">LSMC6DSOX</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">在自己的项目中的时候,则需要考虑设置其中的值。</span></span></p>
<p style="margin-left:72px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><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><span style="font-size:16px;"><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"><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">状态机程序块中,也就不占用内存。</span></span><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">其中<span style="font-weight:bold">黑色字体</span>的就是可以设置的变量,</span></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">T</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">hresh1-3</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,阈值</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,在条件指令中,用来比较输入信号对应轴的数据是</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">否到达阈值。</span></span></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">H</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">ysteresis</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,回滞参数,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">当设置了回滞参数后,在对某轴进行阈值比较时,</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">会将</span></span></span><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">比较值增加回滞参数变成一个比较区间,如下图所示。</span></span></span></p>
<p> </p>
<p> </p>
<p> </p>
<p style="margin-left: 40px;"> </p>
<p style="margin-left: 80px;"> </p>
<p style="margin-left:108px"><span style="font-size:16px;"></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">M</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">asksA-C</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,轴选择掩码</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,用于</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">指定输入数据的哪个轴</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">进行阈值条件或</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">过零条件判断。</span></span></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">T</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">imer1-3</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,定时器值</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,在条件指令中,设置的定时器比较的时间值。</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">D</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">est</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,降频因子,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">用来降低状态机处理传感器数据的频率,</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">将</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">该状态机</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">处理</span></span></span><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">数据的频率降为</span></span><span lang="en-US"><span style="font-family:"Microsoft YaHei"">FSM ODR/Dest</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">。</span></span></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">Decision Tree,机器学习决策树接口,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">通过“</span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">CHKDT</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">”命令检查</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">机器学习</span></span></span><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">核心内部的决策树结果,当</span></span><span lang="en-US"><span style="font-family:"Microsoft YaHei"">FSM</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">和机器学习结合的时候</span></span></span></p>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">就需要用到这个参数。</span></span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""><span style="font-weight:bold">灰色字体</span>的是没法直接设置的变量,</span></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">T</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">emporary MaskA-C</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,临时掩码</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,用来保存</span></span><span lang="en-US"><span style="font-family:"Microsoft YaHei"">MasksA-C</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">的复制值。</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">DX,DY,DZ,DV</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">三轴角度、角度和矢量的模,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">显示的是当前传感器</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">角速度积分得到的角度值。</span></span></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">D</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">eltaT</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,角速度积分参数,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">角速度会乘上该值后积分乘角度值</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">。</span></span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">PAS,</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">Previous axis sign</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,上一个轴号,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">储存前一个采样的轴号,在</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">零点交叉条件下使用</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">。</span></span></span></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">DESC</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,内部计数器,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">在降频时使用,由设备自动管理。</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">TC</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">Timer Counter</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,内部临时定时计数器,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">用于检测定时器是否</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">过期。</span></span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><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></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">分别是</span></span><span style="font-size:16px;"><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 lang="zh-CN" style="font-family:"Microsoft YaHei"">,</span><span lang="en-US" style="font-family:"Microsoft YaHei"">Import State Machine</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:36px"><span style="font-size:16px;"><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 lang="zh-CN" style="font-family:"Microsoft YaHei"">和</span><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 lang="zh-CN" style="font-family:"Microsoft YaHei"">。</span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">当点击Add State按键后,就可以增加一条状态指令,如下图所示</span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">图中红框内容从左至右分别是:</span></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">S0 </span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">状态号</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,随着状态指令增加,状态号依次递增</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">0</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">x06 </span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">状态地址,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">也是随着状态指令增加而增长,</span></span><span lang="en-US"><span style="font-family:"Microsoft YaHei"">Reset Pointer(RP)</span></span></span></li>
</ul>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">复位点</span></span></span><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">和</span></span><span lang="en-US"><span style="font-family:"Times New Roman"">P</span></span><span lang="en-US"><span style="font-family:"Microsoft YaHei"">rogram Pointer(PP)</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">当前运行程序点中的数据就是指这个</span></span></span></p>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">地址,</span></span></span><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">首状态地址随前面固</span></span></span><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">定</span></span></span><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">变量和可变变量总长度而定,图中由于</span></span></span></p>
<p style="vertical-align: middle; margin-left: 120px;"><span style="font-size:16px;"><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">只有</span></span></span><span style="font-size:16px;"><span lang="en-US"><span style="font-family:"Microsoft YaHei"">6</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">个固定长度,因此状态</span></span><span lang="en-US"><span style="font-family:"Microsoft YaHei"">S0</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">地址为</span></span><span lang="en-US"><span style="font-family:"Microsoft YaHei"">0x06</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">。</span></span></span></p>
<ul style="margin-left:72px; unicode-bidi:embed" type="circle">
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">RNC</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">R</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">eset/Next conditions</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">,选择该条状态为条件指令</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">CMD</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,Commands,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">选择该条状态为命令指令</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">指令选择框</span></span><span style="font-family:"Microsoft YaHei"">,选择需要的指令</span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">16</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">进制指令码,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">所选指令的</span></span><span lang="en-US"><span style="font-family:"Times New Roman"">16</span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">进制形式</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">Add</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">增加状态按钮,在</span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">此状态前</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">增加状态</span></span></span></li>
<li style="vertical-align:middle"><span style="font-size:16px;"><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Times New Roman"">R</span></span></span><span lang="en-US"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">emove</span></span></span><span lang="zh-CN"><span style="font-weight:bold"><span style="font-family:"Microsoft YaHei"">,</span></span></span><span lang="zh-CN"><span style="font-family:"Microsoft YaHei"">删除状态按钮,删除此条状态。</span></span></span></li>
</ul>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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 style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">左侧为输入加速度、角速度、输出外部中断INT1/INT2的波形图。</span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">右侧为16个状态机的输出寄存器OUT_Sx的数据,通过点击read,可以读取当前的值。</span></span></p>
<p><span style="font-size:16px;"></span></p>
<p><span style="font-size:16px;"><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 style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">左侧为我们写的状态机图,通过分析它可以很清楚的看到我们的状态机状态是如何</span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">改变的。</span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">右侧为调试区域,通过导入采集的输入数据集,可以对左边的状态机进行仿真调试,</span></span></p>
<p style="margin-left:36px"><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei"">这里就先不细说了。</span></span></p>
<p><span style="font-size:16px;"></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><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></p>
<p><span style="font-size:16px;"><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:16px;"><span style="font-family:"Microsoft YaHei""> </span></span></p>
<p><span style="font-size:16px;"><span lang="zh-CN" style="font-family:"Microsoft YaHei"">以下是</span><span lang="en-US" style="font-family:"Times New Roman"">35</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"">~</span><span lang="zh-CN" style="font-family:"Microsoft YaHei"">:</span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""><span style="font-weight:bold">命令指令</span></span></span></p>
<p><span style="font-size:16px;"></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Microsoft YaHei""><span style="font-weight:bold">条件指令</span></span></span></p>
<p><span style="font-size:16px;"></span></p>
<p> </p>
<p><span style="font-size:16px;">指令集详细介绍的翻译文件放在下方了,大家有什么问题直接下方留言交流呀~</span></p>
<p><span style="font-size:16px;">**** Hidden Message *****</span></p>
</div>
</div>
</div>
感谢科普 <p>好</p>
<p>感谢分享</p>
<p>扫盲</p>
<p>感谢作者的无私付出,谢谢</p>
<p>感谢分享</p>
<p>看看</p>
<p>感谢</p>
页:
[1]