• 大小: 497KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-04-05
  • 语言: 其他
  • 标签: 高精度  

资源简介

电子秤程序,公司做的,已量产,精度50g,最大量程实际180KG,测量速度还行。

资源截图

代码片段和文件信息

#include 
#include 
#include 
#include 
#include 

void amend (void)
{
unsigned long tmp1 =0tmp2;
float  tmpf1;
 
FLAG_CP1 = 1;
if(adc_sum {
FLAG_CP1 = 0;
}
tmp1 = labs(adc_sum - zero_wcd);

if(!FLAG_DATACOPY)
{
tmp2 = labs(tmp1 - oldwghtcode);
}
FLAG_WEIGCHG = 0;
if(FLAG_CALSTAT||FLAG_DATACOPY||(tmp2>Weight_Stat.scale))
{
tmpf1 = (float)tmp1*Weight_Stat.input_weight/Weight_Stat.test_weight*10;
weight = (unsigned long)tmpf1;

_nop_();
tmpf1 = (float)weight*Weight_Stat.test_weight/Weight_Stat.input_weight;
weightcode = (unsigned long)tmpf1;
weightcode = (weightcode+5)/10;
_nop_();

if((tmp1 - weightcode) > (Weight_Stat.scale))
{
weight++;
}
tmp1 = labs(weight - oldwghtdis); 
if(tmp1>(Weight_Stat.min_weight*5)||tmp1>20)
{
FLAG_WEIGCHG = 1;
ADwork_tab1:
combnob = 0x80;
oldwghtcode = weightcode;
oldwghtdis  = weight;
}
else
{
if(oldwghtdis == weight)
{
goto ADwork_tab1;
}
else
{
if(oldwghtdis > weight)
{
combnob++;
}
else
{
combnob--;
}
if(combnob>0x88||combnob<0x78)
{
if(tmp1>(Weight_Stat.min_weight*6)||tmp1>20)
{
FLAG_WEIGCHG = 1;
}
goto ADwork_tab1;
}
else
{
weightcode = oldwghtcode;
weight  = oldwghtdis;
}
}
}
}
else
{
weight = oldwghtdis;
FLAG_WEIGCHG = 0;
}

if(weight {
FLAG_ADDUPV = 1;
FLAG_WEIGCHG = 0;
if(FLAG_LEVELOFF)
{
if(!FLAG_PEEL)
{
creeptims++;
if(creeptims>0x04)
{
creeptims = 0;
if(zero_wcds {
if(labs(adc_sum-zero_wcd)>(Weight_Stat.scale*6)||weight>Weight_Stat.min_weight*Weight_Stat.zero_tracking*5)
{
if(FLAG_CP1)
{
zero_wcd ++;
}
else
{
zero_wcd --;
}
}
else
{
zero_wcd = adc_sum;
weightcode_old = adc_sum;
zero_wcds = zero_wcd;
}
}
}
zero_wcd = adc_sum;
oldwghtdis  = weight =0;
weightcode = oldwghtcode = 0;
}
}
FLAG_GL = 0;
}
else
{
if(FLAG_ADDUPV)
{
FLAG_ADDUP = 0;
}
}

if(((weight {
weight = 0;
oldwghtcode = weightcode;
oldwghtdis  = weight;
FLAG_GL = 0;
FLAG_WEIGCHG = 0;
}
w_caiyang = weight;
tmp2 = Weight_Stat.min_weight*10;
if(!FLAG_CALSTAT&&(weight>Weight_Stat.min_weight*0x3c0))
{
if(weight%tmp2<(tmp2>>1))
{
if(!(weight/tmp2*tmp2%2000))
{
weight = (weight-weight%tmp2)/(Weight_Stat.min_weight)*(Weight_Stat.min_weight);
FLAG_WEIGCHG = 0;
}
}
else
{
if(!((weight+tmp2-weig

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4653  2015-11-21 11:23  说明书\150612\150612\ADwork.c

     文件      13389  2015-11-21 15:25  说明书\150612\150612\ADwork.LST

     文件      27308  2015-11-21 15:25  说明书\150612\150612\ADwork.OBJ

     文件       9770  2015-11-01 23:17  说明书\150612\150612\cal.c

     文件      26172  2015-11-21 15:25  说明书\150612\150612\cal.LST

     文件      35033  2015-11-21 15:25  说明书\150612\150612\cal.OBJ

     文件        261  2015-10-01 00:40  说明书\150612\150612\calibration.h

     文件       8068  2015-11-21 12:39  说明书\150612\150612\config.h

     文件        666  2015-10-01 00:40  说明书\150612\150612\define.h

     文件      10808  2015-10-01 00:40  说明书\150612\150612\display.c

     文件      36124  2015-11-21 15:25  说明书\150612\150612\display.LST

     文件      40976  2015-11-21 15:25  说明书\150612\150612\display.OBJ

     文件       2779  2015-10-01 00:40  说明书\150612\150612\ht1621.c

     文件       3524  2015-10-01 00:40  说明书\150612\150612\ht1621.h

     文件       6085  2015-11-21 15:25  说明书\150612\150612\ht1621.LST

     文件      11237  2015-11-21 15:25  说明书\150612\150612\ht1621.OBJ

     文件       5963  2015-10-01 00:40  说明书\150612\150612\hx71x.c

     文件        968  2015-10-01 00:40  说明书\150612\150612\HX71X.H

     文件      17084  2015-11-21 15:25  说明书\150612\150612\hx71x.LST

     文件      31594  2015-11-21 15:25  说明书\150612\150612\hx71x.OBJ

     文件       1481  2015-10-01 00:40  说明书\150612\150612\intrrupt.c

     文件       4796  2015-11-21 15:25  说明书\150612\150612\intrrupt.LST

     文件      17288  2015-11-21 15:25  说明书\150612\150612\intrrupt.OBJ

     文件      12395  2015-10-01 00:40  说明书\150612\150612\key.c

     文件      40202  2015-11-21 15:25  说明书\150612\150612\key.LST

     文件      40329  2015-11-21 15:25  说明书\150612\150612\key.OBJ

     文件      12724  2015-11-21 15:19  说明书\150612\150612\main.c

     文件      49297  2015-11-21 15:25  说明书\150612\150612\main.LST

     文件      47541  2015-11-21 15:25  说明书\150612\150612\main.OBJ

     文件       1921  2015-10-01 00:40  说明书\150612\150612\other.c

............此处省略35个文件信息

评论

共有 条评论