⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 实用电子秤.htm

📁 本人参见电子竞赛的时候搜集和整理的有关电子秤的资料
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<P class=style27 align=center><STRONG>第一部分: 方案论证与比较 </STRONG></P>
<P class=style27><STRONG>一、控制器部分 </STRONG></P>
<P class=style27>本系统基于 
51系列单片机来实现,因为系统需要大量的控制液晶显示和键盘。不宜采用大规模可编程逻辑器件:CPLD、FPGA来实现。(因为大规模可编程逻辑器件一般是使用状态机方式来实现,即所解决的问题都是规则的有限状态转换问题。本系统状态较多,难度较大。)另外系统没有其它高标准的要求,我们最终选择了AT89S52通用的比较普通单片机来实现系统设计。内部带有8KB的程序存储器,在外面扩展了32K数据存储器,以满足系统要求。 
</P>
<P class=style27><STRONG>二、数据采集部分 </STRONG></P>
<P class=style27><STRONG>( 1 )、传感器 </STRONG></P>
<P class=style27 align=left>题目要求称重范围 9.999Kg ,重量误差不大于 <IMG height=11 
src="实用电子秤.files/20060221151542531.jpg" width=46>Kg 
,考虑到秤台自重、振动和冲击分量,还要避免超重损坏传感器,所以传感器量程必须大于额定称重— <IMG height=14 
src="实用电子秤.files/20060221151542416.jpg" width=54>。我们选择的是 L-PSIII 型传感器,量程 20Kg 
,精度为 <IMG height=11 src="实用电子秤.files/20060221151543435.jpg" width=39>,满量程时误差 
<IMG height=10 src="实用电子秤.files/20060221151543593.jpg" width=7>0.002Kg 
。可以满足本系统的精度要求。其原理如下图所示: </P>
<P class=style27 align=center><IMG height=162 
src="实用电子秤.files/20060221151543333.jpg" width=240></P>
<P class=style27 
align=left>称重传感器主要由弹性体、电阻应变片电缆线等组成,内部线路采用惠更斯电桥,当弹性体承受载荷产生变形时,输出信号电压可由下式给出: <IMG 
height=42 src="实用电子秤.files/20060221151544666.jpg" width=364></P>
<P class=style27 align=left><STRONG>( 2 )、前级放大器部分 </STRONG></P>
<P class=style27>压力传感器输出的电压信号为毫伏级,所以对运算放大器要求很高。 我们考虑可以采用以下几种方案可以采用: </P>
<P class=style27>方案 一 、利用普通低温漂运算放大器构成多级放大器。 </P>
<P class=style27>普通低温漂运算放大器构成多级放大器会引入大量噪声。由于 A/D 
转换器需要很高的精度,所以几毫伏的干扰信号就会直接影响最后的测量精度。所以,此中方案不宜采用。 </P>
<P class=style27>方案二、由高精度低漂移运算放大器构成差动放大器。 </P>
<P class=style27 align=left>差动放大器具有高输入阻抗,增益高的特点,可以利用普通运放 ( 如 OP07) 做成一个差动放大器。 
</P>
<P class=style27 align=center><IMG height=230 
src="实用电子秤.files/20060221151545618.jpg" width=500></P>
<P class=style27 align=left>电阻 R1 、 R2 电容 C1 、 C2 、 C3 、 C4 用于滤除前级的噪声, C1 、 C2 
为普通小电容,可以滤除高频干扰, C3 、 C4 为大的电解电容,主要用于滤除低频噪声。 </P>
<P class=style27 align=left>优点:输入级加入射随放大器,增大了输入阻抗,中间级为差动放大电路,滑动变阻器 R6 
可以调节输出零点,最后一级可以用于微调放大倍数,使输出满足满量程要求。输出级为反向放大器,所以输出电阻不是很大,比较符合应用要求。 </P>
<P class=style27 align=left>缺点:此电路要求 R3 、 R4 
相等,误差将会影响输出精度,难度较大。实际测量,每一级运放都会引入较大噪声。对精度影响较大。 </P>
<P class=style27>方案 三 :采用专用仪表放大器,如: INA126,INA121等。 </P>
<P class=style27>此类芯片内部采用差动输入,共模抑制比高,差模输入阻抗大,增益高,精度也非常好,且外部接口简单。 </P>
<P class=style27>以 INA126为例,接口如下图所示: </P>
<P class=style27 align=center><IMG height=124 
src="实用电子秤.files/20060221151545807.jpg" width=223></P>
<P class=style27>放大器增益 <IMG height=38 src="实用电子秤.files/20060221151546668.jpg" 
width=92>,通过改变 <IMG height=15 src="实用电子秤.files/20060221151546409.jpg" 
width=17>的大小来改变放大器的增益。 </P>
<P class=style27 align=left>基于以上分析,我们决定采用制作方便而且精度很好的专用仪表放大器 INA126 。 </P>
<P class=style27 align=left><STRONG>( 3 )、 A/D 转换器 </STRONG></P>
<P class=style27>由上面对传感器量程和精度的分析可知: A/D 转换器误差应在 <IMG height=11 
src="实用电子秤.files/20060221151546384.jpg" width=39>以下 </P>
<P class=style27>12 位 A/D 精度: 10Kg/4096=2.44g </P>
<P class=style27>14 位 A/D 精度: 10Kg/16384=0.61g </P>
<P class=style27>考虑到其他部分所带来的干扰 ,12 位 A/D 无法满足系统精度要求。 所以我们需要选择 14位或者精度更高的A/D。 
</P>
<P class=style27 align=left>方案一、逐次逼近型 A/D转换器,如:ADS7805、ADS7804等。 </P>
<P class=style27 align=left>逐次逼近型 A/D转换,一般具有采样/保持功能。采样频率高, 功耗比较低,是理想的高速、高精度、省电型 
A/D 转换器件。 </P>
<P class=style27>高精度逐次逼近型 A/D转换器一般都带有内部基准源和内部时钟,基于89C52构成的系统设计时仅需要外接几个电阻、电容。 
</P>
<P class=style27>但考虑到所转换的信号为一慢变信号,逐次逼近型 
A/D转换器的快速的优点不能很好的发挥,且根据系统的要求,14位AD足以满足精度要求,太高的精度就反而浪费了系统资源。所以此方案并不是理想的选择。 </P>
<P class=style27>方案二、双积分型 A/D转换器:如:ICL7135、ICL7109等。 </P>
<P class=style27>双积分型 A/D转换器精度高,但速度较慢(如:ICL7135),具有精确的差分输入,输入阻抗高(大于 <IMG 
height=14 src="实用电子秤.files/20060221151546626.jpg" 
width=46>),可自动调零,超量程信号,全部输出于TTL电平兼容。 </P>
<P class=style27>双积分型 
A/D转换器具有很强的抗干扰能力。对正负对称的工频干扰信号积分为零,所以对50HZ的工频干扰抑制能力较强,对高于工频干扰(例如噪声电压)已有良好的滤波作用。只要干扰电压的平均值为零,对输出就不产生影响。尤其对本系统,缓慢变化的压力信号,很容易受到工频信号的影响。故而采用双积分型A/D转换器可大大降低对滤波电路的要求。 
</P>
<P class=style27>作为电子秤,系统对 
AD的转换速度要求并不高,精度上14位的AD足以满足要求。另外双积分型A/D转换器较强的抗干扰能力,和精确的差分输入,低廉的价格。综合的分析其优点和缺点,我们最终选择了ICL7135。 
</P>
<P class=style27><STRONG>三、人机交互界面 </STRONG></P>
<P class=style27><STRONG>( 1 )、键盘输入 </STRONG></P>
<P class=style27>键盘输入是人机交互界面中最重要的组成部分,它是系统接受用户指令的直接途径。 我们采用了专用的键盘显示芯片 ZLG 7289。 
</P>
<P class=style27>Intel8279 是一种比较成熟的可编程键盘 / 显示芯片,可以满足小系统的要求。 </P>
<P class=style27>ZLG7289 是周立功单片机公司设计的串行输入输出可编程键盘 / 显示芯片有强大的键盘显示功能,支持 64 
键控制。可以比较方便的扩展系统。另外 ZLG7289 内部有译码电路,大大简化了程序。 </P>
<P class=style27>我们选择功能更好的 ZLG7289 作为键盘扫描显示芯片 </P>
<P class=style27><STRONG>( 2 )、显示输出 </STRONG></P>
<P class=style27>虽然 ZLG7289 
具有控制数码管显示的功能,但考虑到本题目要求中文显示,数码管无法满足,只能考虑用带有中文字库的液晶显示器。由于可以分页显示,无需太大屏幕,我们选择了点阵式 
128 × 64 型 LCD — OCM4X8C 。 </P>
<P class=style27 align=center><STRONG>第二部分:具体实现方案 </STRONG></P>
<P class=style27><STRONG>一、硬件组成: </STRONG></P>
<P class=style27><STRONG>(一)、硬件结构框图如下: </STRONG></P>
<P class=style27 align=center><IMG height=127 
src="实用电子秤.files/20060221151547131.jpg" width=452></P>
<P class=style27><STRONG>( 二)、各部分硬件电路实现 </STRONG></P>
<P class=style27><STRONG>(1)、基于AT89S52的主控电路图 </STRONG></P>
<P class=style27><STRONG><IMG height=500 src="实用电子秤.files/20060221151554565.jpg" 
width=651></STRONG></P>
<P class=style27>主控电路以 89C52为核心扩展32K 
RAM;单片机使用6M晶振,P0口外接上拉电阻,增大了带负载能力;A12~A15接74LS138译码器,输出作外部片选信号。 
扩展了几个接口用于其它部分于单片机的通信 </P>
<P class=style27><STRONG>( 2)前端信号处理 </STRONG></P>
<P class=style27>INA126构成的放大器及滤波电路: </P>
<P class=style27 align=center><IMG height=243 
src="实用电子秤.files/20060221151607601.jpg" width=497></P>
<P class=style27>通过调节 <IMG height=15 src="实用电子秤.files/20060221151609625.jpg" 
width=16>的阻值来改变放大倍数。微弱信号Vi1和Vi2被分别放大后从INA126的第6脚输出。A/D转换器ICL7135的输入电压变化范围是-2V~+2V,传感器的输出电压信号在0~20mv左右,因此放大器的放大倍数在200~300左右,可将 
<IMG height=15 src="实用电子秤.files/20060221151609945.jpg" width=16>接成 <IMG 
height=11 src="实用电子秤.files/20060221151609154.jpg" width=27>的滑动变阻器。 </P>
<P class=style27>由于 
ICL7135对高频干扰不敏感,所以滤波电路主要针对工频及其低次谐波引入的干扰。因为压力信号变化十分缓慢,所以滤波电路可以把频率做得很低。 </P>
<P class=style27><STRONG>( 3)A/D转换器 </STRONG></P>
<P class=style27>基于 ICL7135的A/D转换器实现电路: </P>
<P class=style27 align=center><IMG height=296 
src="实用电子秤.files/20060221151609946.jpg" width=532></P>
<P class=style27>基准源选用芯片 MC1403 2.5V分压得到: </P>
<P class=style27 align=center><IMG height=268 
src="实用电子秤.files/20060221151613637.jpg" width=344></P>
<P class=style27>由于 
ICL7135内部没有振荡器,所以需要外接。但A/D转换器精度与时钟频率的漂移无关。正向积分时间T1和反向积分时间T2按相同比例增加并不影响测量的结果。ICL7135的时钟频率典型值为200kHz最高允许为1200kHz,时钟频率越高,转换速度越快。每输出一位BCD码的时间为200个时钟周期,选通脉冲位于数据脉冲的中部,如果时钟频率太高,则数据的接受程序还没有接受完毕,数据就已经消失了。考虑到此系统频率要求不是太高,且单片机的工作频率也不是很高,因此我们取时钟频率的典型值:200kHz。由于频率比较低,对时钟漂移要求不高,我们采用阻容方式实现了基本的振荡电路。如下: 
</P>
<P class=style27 align=center><IMG height=169 
src="实用电子秤.files/20060221151613334.jpg" width=360></P>
<P class=style27>振荡频率约为 160kHz。 </P>
<P class=style27>此外 
ICL7135外部还需要外接积分电阻、积分电容,但A/D转换器精度与外接的积分电阻、积分电容的精度无关,故可以降低对元件质量的要求。不过积分电容和积分电容的介质损耗会影响到A/D转换器的精度,所以应采用介质损耗较小的聚丙乙烯电容 
</P>
<P 
class=style27>ICL7135还需要外接基准电源,这是因为芯片内部的基准源一般容易受到温度的影响,而基准电源的变化会直接影响转换精度。所以当精度要求较高时,应采用外接基准源。一般接其典型值1V。 
</P>
<P class=style27><STRONG>(4) 、人机交互界面 </STRONG></P>
<P class=style27>(a) 、键盘接口图: </P>
<P class=style27 align=center><IMG height=211 
src="实用电子秤.files/20060221151613826.jpg" width=591></P>
<P class=style27>键盘控制芯片 ZLG7289 控制键盘的扫描,当监测到有键按下后 ZLG7289 的 9 
脚便产生一个低电平通知单片机,单片机可以采用查询或者中断方式将数据通过 P1.5 以串行方式读入。因为查询方式会浪费大量的时间 , 所以本系统采用的是中断方式。 
</P>
<P class=style27>(b) 、 LCD 显示接口电路 </P>
<P class=style27 align=center><IMG height=254 
src="实用电子秤.files/20060221151616844.jpg" width=369>. </P>
<P class=style27>LCD 复位信号通过反相器接到单片机的 RESET 上,上电或手动复位时将随单片机同时复位。由于复位后并行口输出高电平, 
LCD 处于选中状态,此时 LCD 将输出内部状态字,将会影响数据总线上的数据传输。所以外接一个反相器。 </P><SPAN 
class=style27><STRONG><BR></STRONG></SPAN>
<P class=style27><STRONG>二、软件组成: </STRONG></P>
<P class=style27><STRONG>(一)、流程图 </STRONG></P>
<P class=style27>&nbsp;</P>
<P class=style27>主程序流程如图所示: </P>
<P class=style27 align=center><IMG height=593 
src="实用电子秤.files/20060221151618506.jpg" width=350></P>
<P class=style27>中断服务程序流程图如下: </P>
<P class=style27 align=center><IMG height=739 
src="实用电子秤.files/20060221151620695.jpg" width=411></P><SPAN 
class=style27><STRONG><BR></STRONG></SPAN>
<P class=style27>&nbsp;</P>
<P class=style27><STRONG>( 2)、软件说明 </STRONG></P>
<P class=style27>由于涉及到大量数据的运算,程序不宜采用汇编语言, C语言大大缩短了开发时间,且程序可读性非常好。 </P>
<P class=style27>程序中对 AD采入的数据进行了数字滤波,进一步减小AD读入数据的误差。 </P>
<P class=style27>7289键盘控制采用中断方式,加快了程序的执行效率。 </P>
<P class=style27>详细的操作过程见使用说明。 </P>
<P class=style27>&nbsp;</P>
<P class=style27 align=center><STRONG>第三部分:测试及结果分析 </STRONG></P>
<P class=style27>&#8226;&nbsp; <STRONG>测试结果及误差分析: </STRONG></P>
<TABLE borderColor=#e4e4e4 cellSpacing=0 cellPadding=3 align=center border=1>
  <TBODY>
  <TR>
    <TD class=style27 width=119>
      <P align=center>砝码重量( g ) </P></TD>
    <TD class=style27 width=119>
      <P align=center>实际显示重量 1 ( g ) </P></TD>
    <TD class=style27 vAlign=top width=118>
      <P align=center>实际显示重量 2 ( g ) </P></TD>
    <TD class=style27 vAlign=top width=108>
      <P align=center>实际显示重量 3 ( g ) </P></TD></TR>
  <TR>
    <TD class=style27 width=119>
      <P align=center>100 </P></TD>
    <TD class=style27 width=119>
      <P align=center>99 </P></TD>
    <TD class=style27 vAlign=top width=118>
      <P align=center>99 </P></TD>
    <TD class=style27 vAlign=top width=108>
      <P align=center>98 </P></TD></TR>
  <TR>
    <TD class=style27 width=119>
      <P align=center>150 </P></TD>
    <TD class=style27 width=119>
      <P align=center>148 </P></TD>
    <TD class=style27 vAlign=top width=118>
      <P align=center>147 </P></TD>
    <TD class=style27 vAlign=top width=108>
      <P align=center>149 </P></TD></TR>
  <TR>
    <TD class=style27 width=119>
      <P align=center>200 </P></TD>
    <TD class=style27 width=119>
      <P align=center>195 </P></TD>
    <TD class=style27 vAlign=top width=118>
      <P align=center>197 </P></TD>
    <TD class=style27 vAlign=top width=108>
      <P align=center>198 </P></TD></TR>
  <TR>
    <TD class=style27 width=119>
      <P align=center>250 </P></TD>
    <TD class=style27 width=119>
      <P align=center>244 </P></TD>
    <TD class=style27 vAlign=top width=118>
      <P align=center>246 </P></TD>
    <TD class=style27 vAlign=top width=108>
      <P align=center>244 </P></TD></TR>
  <TR>
    <TD class=style27 width=119>
      <P align=center>300 </P></TD>
    <TD class=style27 width=119>
      <P align=center>295 </P></TD>
    <TD class=style27 vAlign=top width=118>
      <P align=center>296 </P></TD>
    <TD class=style27 vAlign=top width=108>
      <P align=center>294 </P></TD></TR>
  <TR>
    <TD class=style27 width=119>
      <P align=center>350 </P></TD>
    <TD class=style27 width=119>
      <P align=center>342 </P></TD>
    <TD class=style27 vAlign=top width=118>
      <P align=center>344 </P></TD>
    <TD class=style27 vAlign=top width=108>
      <P align=center>343 </P></TD></TR>
  <TR>
    <TD class=style27 width=119>
      <P align=center>400 </P></TD>
    <TD class=style27 width=119>
      <P align=center>393 </P></TD>
    <TD class=style27 vAlign=top width=118>
      <P align=center>395 </P></TD>
    <TD class=style27 vAlign=top width=108>
      <P align=center>396 </P></TD></TR>
  <TR>
    <TD class=style27 width=119>
      <P align=center>450 </P></TD>
    <TD class=style27 width=119>
      <P align=center>443 </P></TD>
    <TD class=style27 vAlign=top width=118>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -