TI - MCU - MSP430使用指南34 -> USS 模块
<div class='showpostmsg'><p><b><font color="#5E7384">此内容由EEWORLD论坛网友<font size="3">骑IC看MCU</font>原创,如需转载或用于商业用途需征得作者同意并注明出处</font></b></p><p> </p>
<p><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">USS<span lang="ZH-CN" style="font-family:宋体">模块,即</span>Ultrasonic sensing syolution, <span lang="ZH-CN" style="font-family:宋体">超声波感知模块。这个资源设计主要面向表类市场,主要是水表和气表,因为目前的水表,气表等大多采用机械式的方式,但是损耗,精度,量程等都很难满足现在发展的需求,故</span>USS<span lang="ZH-CN" style="font-family:宋体">模块借助这先进的理论及算法,在水表和气表方面表现很突出,下分别针对水表和气表两个方面对</span>USS<span lang="ZH-CN" style="font-family:宋体">模块进行分析。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">目前</span>MSP430<span lang="ZH-CN" style="font-family:宋体">集成</span>USS<span lang="ZH-CN" style="font-family:宋体">模块的</span>MCU<span lang="ZH-CN" style="font-family:宋体">有</span>MSP430FR6047(<span lang="ZH-CN" style="font-family:宋体">面向水表</span>)<span lang="ZH-CN" style="font-family:宋体">,</span>MSP430FR6043(<span lang="ZH-CN" style="font-family:宋体">面向气表及水表,主要针对气表</span>)<span lang="ZH-CN" style="font-family:宋体">。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Section 1<span lang="ZH-CN" style="font-family:宋体">:使用</span>MSP430FR6047<span lang="ZH-CN" style="font-family:宋体">去设计智能水表。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">先看一下</span>FR6047<span lang="ZH-CN" style="font-family:宋体">的资源及内部功能介绍:</span></span></span></span></p>
<p style="margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">先看一下资源框图,主要的模块也就是多路一个</span>USS Subsystem<span lang="ZH-CN" style="font-family:宋体">,同时内部会有</span>LEA<span lang="ZH-CN" style="font-family:宋体">子系统,主要用于</span>USS<span lang="ZH-CN" style="font-family:宋体">相关的算法计算。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">首先,我们分析一下超声波检测的原理:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">超声波检测,和测距原理差不多,都是基于声波在空气</span>/<span lang="ZH-CN" style="font-family:宋体">水中的传播为基础的,如下图所示,在通水的管道中如下安装:</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">常用安装方式如上图四种,探头和接收模块在一器,因此会有两个探头</span>T12<span lang="ZH-CN" style="font-family:宋体">和</span>T21<span lang="ZH-CN" style="font-family:宋体">,</span>T12<span lang="ZH-CN" style="font-family:宋体">发送声波,</span>T21<span lang="ZH-CN" style="font-family:宋体">去感知,然后</span>T21<span lang="ZH-CN" style="font-family:宋体">发送声波,</span>T12<span lang="ZH-CN" style="font-family:宋体">去感知,通过这种方式便可以计算出管道内的流速,从而计算水量。理论分析如下:</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">换能器(也即是探头,将电能转换成声波,或者将声波转换成电信号,因此叫换能器)</span>1<span lang="ZH-CN" style="font-family:宋体">和换能器</span>2<span lang="ZH-CN" style="font-family:宋体">与管道成一定角度相对放置,图中</span><m:omath><span style="font-family:"Cambria Math","serif""><m:r><m:rpr><m:scr m:val="roman"><m:sty m:val="p"></m:sty></m:scr></m:rpr>V</m:r></span></m:omath></span></span></span><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">为流体的流速,</span><m:omath><span style="font-family:"Cambria Math","serif""><m:r><m:rpr><m:scr m:val="roman"><m:sty m:val="p"></m:sty></m:scr></m:rpr>∅</m:r></span></m:omath></span></span></span><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">是换能器安装过程中与管道的夹角,</span>D<span lang="ZH-CN" style="font-family:宋体">为管道的内直径,</span>L<span lang="ZH-CN" style="font-family:宋体">是两个换能器的距离,</span>C<span lang="ZH-CN" style="font-family:宋体">为声波在介质中的传播速度。则根据上图所示,可以得到以下公式:</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p> </p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">然后进行公示的转换可以得到下面的公式:</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">好了,到这一步,我们也就把超声波测距的原理及我们需要去测量的变量计算出来了。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">首先对于公式中</span>Area<span lang="ZH-CN" style="font-family:宋体">这一部分,就是个常数,跟实际管道的尺寸,安装有关系,所以这一块不需要我们考虑。我们需要测量的就是相对飞行时间</span>delta T<span lang="ZH-CN" style="font-family:宋体">和绝对飞行时间</span>T12<span lang="ZH-CN" style="font-family:宋体">和</span>T21<span lang="ZH-CN" style="font-family:宋体">了。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">后面将正式进入</span>USS<span lang="ZH-CN" style="font-family:宋体">模块的使用讲解了。由于</span>USS<span lang="ZH-CN" style="font-family:宋体">模块个</span>MCU<span lang="ZH-CN" style="font-family:宋体">内部其他资源不相同,因为这个模块比较难,内部寄存器配置等和实际测量出来的效果相关度很大,同时如何根据发送的超声波及接受到的回波去计算绝对飞行时间和相对飞行时间需要算法的配合,因此</span>TI<span lang="ZH-CN" style="font-family:宋体">提供了一个</span>GUI<span lang="ZH-CN" style="font-family:宋体">上位机,同时这个</span>GUI<span lang="ZH-CN" style="font-family:宋体">可以根据配置生成</span>MSP430<span lang="ZH-CN" style="font-family:宋体">的软件程序,直接能给出绝对飞行时间和相对飞行时间。因此本此讲解不会介绍</span>USS<span lang="ZH-CN" style="font-family:宋体">寄存器级别的配置程序,而是讲解如何使用</span>TI<span lang="ZH-CN" style="font-family:宋体">提供的资源去开发自己的水表、气表产品。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">首先,你需要一个</span>TI<span lang="ZH-CN" style="font-family:宋体">的</span>MSP430 EVM<span lang="ZH-CN" style="font-family:宋体">板:</span>EVM430-FR6047</span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">就这个卵样子的一块板子,上面包含了下载器电路,串口电路,</span>LCD<span lang="ZH-CN" style="font-family:宋体">电路,超声波信号调理电路等,反正一句话,有了它,配合上换能器,你就能放飞自我去测量水的流速和流量。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">接上面一句话,换能器?</span> <span lang="ZH-CN" style="font-family:宋体">什么东东。也就是超声波的探头了,不过是收发一体的,长这个样子:</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">一种压电陶瓷产品,注意</span> <span lang="ZH-CN" style="font-family:宋体">这个东东</span> <span lang="ZH-CN" style="font-family:宋体">有技术含量呦,不是每家公司做出来的都能有很好的精度和一致性的,想了解关于换能器的技术细节,夸克去吧,我也不会。。。。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">然后呢,在有了这两个宝贝之后,按照下图所示连接,下图中将两个换能器放在管道内了。</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">这样就搭建好了我们实验的硬件条件,</span>EVM<span lang="ZH-CN" style="font-family:宋体">板,换能器,那么首先我们来分析以下这个</span>EVM<span lang="ZH-CN" style="font-family:宋体">板主要的电路图吧。附上详细的电路图连接:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">http://www.ti.com/lit/zip/slar139</span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">其他电路都比较简单,主要是最小系统电路及</span>LCD<span lang="ZH-CN" style="font-family:宋体">显示灯,我们这里主要讲两块电路:</span></span></span></span></p>
<ol>
<li style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">与上位机</span>GUI<span lang="ZH-CN" style="font-family:宋体">通信</span></span></span></span></li>
</ol>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">这一块也比较简单,但是这里注释一点,如下图所示,与</span>PC<span lang="ZH-CN" style="font-family:宋体">端连接是使用的</span>USB<span lang="ZH-CN" style="font-family:宋体">接口,但是</span>MSP430FR6047<span lang="ZH-CN" style="font-family:宋体">与上位机通信支持</span>I2C<span lang="ZH-CN" style="font-family:宋体">接口和</span>UART<span lang="ZH-CN" style="font-family:宋体">接口,因为中间使用了一个</span>HID bridge<span lang="ZH-CN" style="font-family:宋体">。你在板子上可以看到</span>J1<span lang="ZH-CN" style="font-family:宋体">接口处,利用跳线帽可以选择使用哪个接口,但是</span> <span lang="ZH-CN" style="font-family:宋体">注意</span> <span lang="ZH-CN" style="font-family:宋体">强烈建议你使用</span>I2C<span lang="ZH-CN" style="font-family:宋体">接口,因为速度快,稳定,如果你使用</span>UART<span lang="ZH-CN" style="font-family:宋体">接口的话,可能后面会出现</span>ADC<span lang="ZH-CN" style="font-family:宋体">波形不能实时更新的情况,而且这个</span>UART<span lang="ZH-CN" style="font-family:宋体">口</span>TI<span lang="ZH-CN" style="font-family:宋体">说可以使用,但是我研究发现内部去当程序可能有点</span>bug<span lang="ZH-CN" style="font-family:宋体">,因此,使用</span>I2C<span lang="ZH-CN" style="font-family:宋体">接口,使用</span>I2C<span lang="ZH-CN" style="font-family:宋体">接口,使用</span>I2C<span lang="ZH-CN" style="font-family:宋体">接口,重要的事情说三遍。</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<ol start="2">
<li style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">超声波的发送接收电路</span></span></span></span></li>
</ol>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">如上图所示这一快是</span>USS<span lang="ZH-CN" style="font-family:宋体">测量电路,</span>CH_OUT<span lang="ZH-CN" style="font-family:宋体">接了一个</span>200R<span lang="ZH-CN" style="font-family:宋体">电阻后驱动换能器,</span>CH_IN<span lang="ZH-CN" style="font-family:宋体">则需要接一个电容接到换能器上,目的是为了隔离直流信号。</span>USSXOUT<span lang="ZH-CN" style="font-family:宋体">和</span>USSXIN<span lang="ZH-CN" style="font-family:宋体">需要接一个晶振,这里推荐</span>8MHz<span lang="ZH-CN" style="font-family:宋体">,后面再</span>GUI<span lang="ZH-CN" style="font-family:宋体">中需要配置。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">硬件环境搭建完知乎,我们开始准备软件方面的工作,软件方面主要包括两块:上位机</span>GUI<span lang="ZH-CN" style="font-family:宋体">和</span>Code<span lang="ZH-CN" style="font-family:宋体">,这两块</span>TI<span lang="ZH-CN" style="font-family:宋体">都是提供的。连接如下:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/USSSWLib/USSSWLibWater/latest/index_FDS.html</span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">在这个页面中,你能看到两个内容:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">GUI(USSSWLib) <span lang="ZH-CN" style="font-family:宋体">和</span> Code</span></span></span></p>
<p style="margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">把这两个下载下来进行安装,安装正常后可以看到以下两个内容:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">GUI : <span lang="ZH-CN" style="font-family:宋体">这个就是上位机应用了,用来我们调试修改参数使用的</span></span></span></span></p>
<p style="margin-bottom:14px"></p>
<p style="margin-bottom:14px"> </p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">CODE: <span lang="ZH-CN" style="font-family:宋体">这个是</span>TI<span lang="ZH-CN" style="font-family:宋体">提供的程序,可以在</span>CCS<span lang="ZH-CN" style="font-family:宋体">或者</span>IAR<span lang="ZH-CN" style="font-family:宋体">编译环境中进行编译,其中包含一些</span>Lib<span lang="ZH-CN" style="font-family:宋体">文件,即只能使用,不能看源文件。</span></span></span></span></p>
<p style="margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">注意一个点:安装</span>GUI<span lang="ZH-CN" style="font-family:宋体">时需要</span>JAVA JRE 1.7<span lang="ZH-CN" style="font-family:宋体">以上的环境支持,没安装的给安装以下,连接如下:</span><br />
https://www.java.com/en/download/</span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">同时</span>CODE<span lang="ZH-CN" style="font-family:宋体">也需要</span>CCS<span lang="ZH-CN" style="font-family:宋体">及</span>IAR<span lang="ZH-CN" style="font-family:宋体">相应版本才能正常导入编译,下图中给的信息可以在</span>GUI<span lang="ZH-CN" style="font-family:宋体">安装后的文件夹中一个</span>html<span lang="ZH-CN" style="font-family:宋体">网址文件看到,具体和版本不同也不相同,因此具体看你使用的哪个版本。</span></span></span></span></p>
<p style="margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">首先,为了连接</span>GUI<span lang="ZH-CN" style="font-family:宋体">,需要先对</span>EVM<span lang="ZH-CN" style="font-family:宋体">中的</span>FR6037<span lang="ZH-CN" style="font-family:宋体">下载程序,程序在安装后的以下路径:</span></span></span></span><br />
</p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">下载工具可以使用</span>CCS<span lang="ZH-CN" style="font-family:宋体">指定下载文件或者</span>UniFlash.<span lang="ZH-CN" style="font-family:宋体">然后进行上位机的连接操作:</span></span></span></span><br />
</p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">在</span>option<span lang="ZH-CN" style="font-family:宋体">中选择</span>FR6047 <span lang="ZH-CN" style="font-family:宋体">水表,然后</span>OK<span lang="ZH-CN" style="font-family:宋体">。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">再点击</span>Communications<span lang="ZH-CN" style="font-family:宋体">中的</span>connect<span lang="ZH-CN" style="font-family:宋体">,如下图所示,下面有这个标记表明连接成功。这时你就可以对</span>MCU<span lang="ZH-CN" style="font-family:宋体">内部参数进行配置和调试了。</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">下面我们来分析以下每个参数代表的意思:</span></span></span></span></p>
<ul>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Transmit frequency: <span lang="ZH-CN" style="font-family:宋体">换能器工作频率,一般水表的再</span>1MHz<span lang="ZH-CN" style="font-family:宋体">这个时换能器的参数。</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Gap between pulse start and ADC capture: <span lang="ZH-CN" style="font-family:宋体">从发送脉冲波到开启</span>ADC<span lang="ZH-CN" style="font-family:宋体">采样的时间。</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Number of Pulses: <span lang="ZH-CN" style="font-family:宋体">发送的脉冲个数,这个脉冲是去启动换能器去发送超声波信号的。</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">UPS and DNS Gap: <span lang="ZH-CN" style="font-family:宋体">通道</span>1<span lang="ZH-CN" style="font-family:宋体">发送</span> <span lang="ZH-CN" style="font-family:宋体">到通道</span>2<span lang="ZH-CN" style="font-family:宋体">发送之间的间隔。</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">UPS0 to UPS1 Gap: <span lang="ZH-CN" style="font-family:宋体">一个通道发送脉冲波的时间间隔。</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">GUI Based Gain Control: <span lang="ZH-CN" style="font-family:宋体">基本放大增益,</span>MCU<span lang="ZH-CN" style="font-family:宋体">内部有一个可调的放大器,用于放大接收到的回波信号的。</span></span></span></span></li>
<li style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Meter Constant: <span lang="ZH-CN" style="font-family:宋体">水表常数,就是前面原理中所计算的那个</span>Area<span lang="ZH-CN" style="font-family:宋体">常数,这个建议大家还是通过测试得到,因为计算的太理想化,误差较大。</span></span></span></span></li>
</ul>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">然后让我们看第二页:</span>Advanced Parameters</span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">这一块里面也有一堆参数,但是我就不每个都讲了,大家可以从这个链接中看到每个参数的含义:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"> <span lang="ZH-CN" style="font-family:宋体">这个文件</span> <span lang="ZH-CN" style="font-family:宋体">:</span>C:\ti\msp\USS_02_30_00_03\USS\docs\UserGuide\UserGuide\ch_config.html</span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">PS<span lang="ZH-CN" style="font-family:宋体">:可能根据你安装的位置不同,有所区别。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">说一下主要的参数:</span></span></span></span></p>
<ul>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">USSXT<span lang="ZH-CN" style="font-family:宋体">:就是前面硬件电路中提到的接的晶振频率,</span>8000KHz = 8MHz</span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Signal Sampling Frequency : ADC<span lang="ZH-CN" style="font-family:宋体">的采样频率,采样频率越高</span> <span lang="ZH-CN" style="font-family:宋体">波形越详细,但是占用内存越大,默认即可。</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Capture Duration : ADC<span lang="ZH-CN" style="font-family:宋体">采样的时间,这个和脉冲数有关系,如果脉冲数多了</span> <span lang="ZH-CN" style="font-family:宋体">这个需要放大一点,保证能猜到完成的回波形状。</span></span></span></span></li>
<li style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">其他的参数无非是一些算法选择,零漂设置,启动</span>ADC PGA<span lang="ZH-CN" style="font-family:宋体">时间等一堆,建议大家</span> <span lang="ZH-CN" style="font-family:宋体">直接默认。</span></span></span></span></li>
</ul>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">参数配置完之后,可以看到下面五个按键:</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<ul>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Request Update <span lang="ZH-CN" style="font-family:宋体">:讲参数更新到</span>MCU<span lang="ZH-CN" style="font-family:宋体">中</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Save Configuration <span lang="ZH-CN" style="font-family:宋体">:保存参数</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Load Configuration <span lang="ZH-CN" style="font-family:宋体">:加载参数</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Reset Values <span lang="ZH-CN" style="font-family:宋体">:复位参数设置</span></span></span></span></li>
<li style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Generate Headers<span lang="ZH-CN" style="font-family:宋体">:生成头文件</span></span></span></span></li>
</ul>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">这些里面可能需要讲的一个就是生成头文件了,点击后,你会发现生成了下面三个文件,这三个文件起始就是你配置的参数,讲这三个文件替换掉</span>CODE<span lang="ZH-CN" style="font-family:宋体">中相应的文件</span> <span lang="ZH-CN" style="font-family:宋体">编译下载就可以更新到</span>MCU<span lang="ZH-CN" style="font-family:宋体">内部了。</span></span></span></span></p>
<p style="margin-bottom:14px"></p>
<p style="margin-bottom:14px"><br />
<span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">下面我们说一下</span>GUI<span lang="ZH-CN" style="font-family:宋体">其他界面:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">如下图所示是</span>Waveforms<span lang="ZH-CN" style="font-family:宋体">界面,可以实时显示绝对飞行时间和相对飞行时间以及水的流量。</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">点击进入</span>ADC Capture<span lang="ZH-CN" style="font-family:宋体">界面,这个界面比较关键,这个显示的额就是接收到的超声回波,这个波形的好坏决定了检测的精度。如下图所示:</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">这个波形就比较好,显示了</span>T1<span lang="ZH-CN" style="font-family:宋体">发送</span>T2<span lang="ZH-CN" style="font-family:宋体">接收和</span>T2<span lang="ZH-CN" style="font-family:宋体">发送</span>T1<span lang="ZH-CN" style="font-family:宋体">接收的波形,一般情况下纵坐标需要在几百以上,这样有利于算法检测。可以看出,得到的回波,首先是换能器起振最后完全震荡起来,最后关闭的过程,利用这个过程,我们就可以计算绝对飞行时间和相对飞行时间了。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">其他的界面,使用到的频率比较低,我就不介绍了,大家有兴趣的话,可以在</span>GUI<span lang="ZH-CN" style="font-family:宋体">及</span>CODE<span lang="ZH-CN" style="font-family:宋体">这两个安装目录中找到相关的网页文件。</span>PS<span lang="ZH-CN" style="font-family:宋体">:推荐大家看官方文件,比较详细而且权威。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">下面</span> <span lang="ZH-CN" style="font-family:宋体">我们讲以下这个</span>USS<span lang="ZH-CN" style="font-family:宋体">测量模块的算法思想:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">TI<span lang="ZH-CN" style="font-family:宋体">的</span>EVM-FR6047<span lang="ZH-CN" style="font-family:宋体">计算出来的流量精度很高,高于目前市场上的几块相似产品,核心有两块:</span></span></span></span></p>
<ul>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">FR6047<span lang="ZH-CN" style="font-family:宋体">单芯片解决方案,讲很多超声波发送接收电路集成到了芯片中,稳定,精度高。</span></span></span></span></li>
<li style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">算法:求解相对飞行时间的算法较为精确。(这一块具体实现是</span>lib<span lang="ZH-CN" style="font-family:宋体">文件,源程序不对外开放,但是用户可以使用)</span></span></span></span></li>
</ul>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">首先,求绝对飞行时间,也就是</span>T12<span lang="ZH-CN" style="font-family:宋体">和</span>T21<span lang="ZH-CN" style="font-family:宋体">,就是发送超声波开始计时,收到超声波回波后结束计时,记录下这个时间差,核心载入如何检测到回波,这个</span>TI<span lang="ZH-CN" style="font-family:宋体">算法采用检测回波包络的方法,一般检测到包络的峰值点</span>50%<span lang="ZH-CN" style="font-family:宋体">即可认为检测到了回波。这个算法很正常,中规中矩。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">其次,对于相对飞行时间,</span>delta T = T12 – T21<span lang="ZH-CN" style="font-family:宋体">,如果使用上面计算出来的</span>T12<span lang="ZH-CN" style="font-family:宋体">和</span>T21<span lang="ZH-CN" style="font-family:宋体">带进去计算,会导致出现累计误差,精度较低,因此</span>TI<span lang="ZH-CN" style="font-family:宋体">采用了相似性计算的方法去计算这个</span>delta T<span lang="ZH-CN" style="font-family:宋体">。</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">如上图所示,收到两个回波后,首先先对回波进行处理,拟合三角函数关系,然后讲两个回波进行相似度计算,找到最大相似的点,这个时刻两个波形的横坐标只差即可得到相对飞行时间。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">好了,</span>MSP430FR6047<span lang="ZH-CN" style="font-family:宋体">的水表解决方案的大致内容已经全部描述完了,总结一下:</span></span></span></span></p>
<ul>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">你需要</span>EVM-FR6047<span lang="ZH-CN" style="font-family:宋体">板子,换能器,硬件</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">你需要安装</span>GUI COD<span lang="ZH-CN" style="font-family:宋体">程序</span></span></span></span></li>
<li style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">在</span>GUI<span lang="ZH-CN" style="font-family:宋体">上进行参数设置</span>(<span lang="ZH-CN" style="font-family:宋体">一般默认就行</span>)<span lang="ZH-CN" style="font-family:宋体">,然后可以生成头文件,替换到</span>code<span lang="ZH-CN" style="font-family:宋体">中的文件,编译下载就可以开发自己的产品</span></span></span></span></li>
</ul>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">最后一句建议,关于这些</span> <span lang="ZH-CN" style="font-family:宋体">有哪些不懂的</span> <span lang="ZH-CN" style="font-family:宋体">第一反应要去查看</span>GUI<span lang="ZH-CN" style="font-family:宋体">和</span>CODE<span lang="ZH-CN" style="font-family:宋体">安装目录,里面有好几个网页文件,网页里信息很多,讲的很详细,而且很权威,总的一句话</span> <span lang="ZH-CN" style="font-family:宋体">官方文件比什么第三方都好!</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">Section 2<span lang="ZH-CN" style="font-family:宋体">:使用</span>MSP430FR6043<span lang="ZH-CN" style="font-family:宋体">去设计智能气表。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">上面对</span>MSP430FR6047<span lang="ZH-CN" style="font-family:宋体">使用方法讲的比较详细了,</span>FR6043<span lang="ZH-CN" style="font-family:宋体">方法基本相同,不同点我会着重讲一下,其他步骤直接参考</span>FR6047<span lang="ZH-CN" style="font-family:宋体">的水表配置。</span>EVM430-FR6043</span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">首先软件需要下载的:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/USSSWLib/USSSWLibGas/latest/index_FDS.html</span></span></span></p>
<p style="margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">GUI : <span lang="ZH-CN" style="font-family:宋体">和</span>FR6047<span lang="ZH-CN" style="font-family:宋体">一样的。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">CODE Link <span lang="ZH-CN" style="font-family:宋体">:</span>http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/USSSWLib/USSSWLibGas/latest/exports/UltrasonicGasFR6043_02_30_00_01_windows_installer.exe</span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">硬件板子呢,长这个样子:</span></span></span></span></p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">连上气表换能器之后呢,是这个样子:</span></span></span></span></p>
<p style="margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">讲一下区别:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">FR6043<span lang="ZH-CN" style="font-family:宋体">内部的超声波</span>USS<span lang="ZH-CN" style="font-family:宋体">模块支持扫频功能,何为扫频功能呢:也就是给换能器驱动的频率在变化,有个范围,可以在</span>GUI<span lang="ZH-CN" style="font-family:宋体">中设置,这个也就是为什么</span>FR6043<span lang="ZH-CN" style="font-family:宋体">既能做水表也能做气表的原因。因为超声波在空气总衰减比较快,所以固定频率的话</span> <span lang="ZH-CN" style="font-family:宋体">效果较差,当然了,也有内部</span>USS<span lang="ZH-CN" style="font-family:宋体">设计的区别,不仅仅是这个点。</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">主要区别:硬件电路图:</span>http://www.ti.com/lit/pdf/tidrys5</span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">我们只看超声波发送采集这一块:</span></span></span></span></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">你会发现,虽然有两路通道</span>CH0<span lang="ZH-CN" style="font-family:宋体">和</span>CH1<span lang="ZH-CN" style="font-family:宋体">,但是实际电路中使用了模拟开关切换的,仅仅使用了</span>CH0<span lang="ZH-CN" style="font-family:宋体">,估计这个是处于一致性的考虑吧,这样能保证驱动两个换能器和接收波形是电路走线一致,减少误差吧。</span></span></span></span></p>
<p style="margin-bottom:14px"></p>
<p style="margin-bottom:14px"> </p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">其次使用上位机时</span> <span lang="ZH-CN" style="font-family:宋体">也有点区别:如下图所示,这里要选用</span>F1 to F2 Sweep<span lang="ZH-CN" style="font-family:宋体">,即扫频功能,一般气表换能器的工作频率时</span>200KHz<span lang="ZH-CN" style="font-family:宋体">和</span>500KHz<span lang="ZH-CN" style="font-family:宋体">,因此针对</span>200KHz<span lang="ZH-CN" style="font-family:宋体">的可以设置成</span>180-220<span lang="ZH-CN" style="font-family:宋体">扫频。</span></span></span></span></p>
<p style="margin-bottom:14px"> </p>
<p align="center" style="text-align:center; margin-bottom:14px"></p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">然后其次就是在生成头文件过程中,生成的文件不再是水表那种三个文件,好像没有三个,具体看实际结果吧,不够最后操作都是一样的,替换掉</span>CODE<span lang="ZH-CN" style="font-family:宋体">中对应的文件,编译下载到</span>MCU<span lang="ZH-CN" style="font-family:宋体">中。</span></span></span></span></p>
<p style="margin-bottom:14px"> </p>
<p style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">PS <span lang="ZH-CN" style="font-family:宋体">:</span> <span lang="ZH-CN" style="font-family:宋体">附上一些问题的解决方法:</span></span></span></span></p>
<ul>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">ADC<span lang="ZH-CN" style="font-family:宋体">波形不对:看看换能器正负有没有接反,波形有多大,换能器有没有起振,用示波器测一下驱动波形看看是否正确。</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">得不到正确的</span>TOF<span lang="ZH-CN" style="font-family:宋体">:参数配置,参数配置,不能乱配,在安装目录里有网页文件描述每个参数的范围,同时每个参数之间也有协调,比如脉冲数和采样时间。</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">ADC<span lang="ZH-CN" style="font-family:宋体">波形:这个有三个变量:发送到采样时间间隔,脉冲数,采样时间。根据波形判断哪个参数不合适,这个分析起来很简单。</span></span></span></span></li>
<li><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span lang="ZH-CN" style="font-family:宋体">连接不上</span>GUI<span lang="ZH-CN" style="font-family:宋体">,看看程序有没有下载错,板子上</span>I2C<span lang="ZH-CN" style="font-family:宋体">先有没有接,</span>GUI<span lang="ZH-CN" style="font-family:宋体">中</span>MCU<span lang="ZH-CN" style="font-family:宋体">类型及表的类型有没有选错。</span></span></span></span></li>
<li style="margin-bottom:14px"><span style="font-size:11pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">LCD<span lang="ZH-CN" style="font-family:宋体">不显示:这个程序中关闭了</span>LCD<span lang="ZH-CN" style="font-family:宋体">显示,因此不显示正常,你可以自己修改程序开启。</span></span></span></span></li>
</ul>
</div><script> var loginstr = '<div class="locked">查看精华帖全部内容,请<a href="javascript:;" style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
if(parseInt(discuz_uid)==0){
(function($){
var postHeight = getTextHeight(400);
$(".showpostmsg").html($(".showpostmsg").html());
$(".showpostmsg").after(loginstr);
$(".showpostmsg").css({height:postHeight,overflow:"hidden"});
})(jQuery);
}
</script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script> <p>感谢楼主,这个教程好棒!</p>
<p>真心不错,分享的很详细啊,原理图还有原理公式。谢谢啦、</p>
楼主厉害呀,资料很好,凑个热闹,来看看楼主的学习笔记 <p>学习了</p>
挺好 <p>多谢分享!多谢分享!多谢分享!多谢分享!多谢分享!多谢分享!</p>
页:
[1]