HX711做电子称,不明白下面的程序和芯片什么关系,求指点...

2019-07-16 01:47发布

#ifndef _shizhong_h_
#define _shizhong_h_
#include <reg51.H>
#include <key.H>
#include<hx711.h>
#include <lcd_1602.H>
#define uint unsigned int
#define uchar unsigned char
sbit buzz=P1^0;
sbit clock=P2^1;
uchar clock_flag;
uint clock_count1;
uchar clock_count;

///////////////////////////////////////////////////////////////////////
//电子
uchar idata pricetable[3]={0,0,0};

int weight;
uint price,money;
uint temp,qi_weight;
bit chaozhong_flag;

/////////////////////////////////////////////////////////////////////////

void Delay10ms(void)           //延时10ms
{
        uint i,j,k;
        for(i=5;i>0;i--)
        for(j=4;j>0;j--)
        for(k=248;k>0;k--);
}                  
void init()                //
{
        TMOD=0x11;
        TH0=0x3c;
        TL0=0xb0;        //定时50ms        11.0592
        TH1=0x3c;
        TL1=0xb0;        //定时50ms        11.0592
        TR0=1;
        TR1=1;
        ET0=1;
        ET1=1;
        EA=1;
}
void t0() interrupt 1 using 0
{
        TH0=0x3c;
        TL0=0xb0;        //定时50ms

        if((weight>5000)&&(chaozhong_flag==1))
        {
                clock=0;
        }
        else
        {chaozhong_flag=0;TR0=0;clock=1;}

}

void t1() interrupt 3
{
        TH1=0x3c;
        TL1=0xb0;        //定时50ms             //主要是这不明白
        if(clock_flag==1)
        {
                clock_count++;
                clock_count1++;
                if(clock_count1==6000)
                {
                        clock_flag=0;
                        clock_count1=0;
                        clock=1;
                        TR1=0;                       
                }
                if(clock_count<4)
                {
                        clock=0;       
                }
                else if(clock_count<11)
                {
                        clock=1;               
                }
                else if(clock_count<13)
                {
                        clock=0;               
                }
                else if(clock_count<16)
                {
                        clock=1;               
                }       
                else if(clock_count<18)
                {
                        clock=0;               
                }
                else if(clock_count<27)
                {
                        clock=1;               
                }
                if(clock_count==27)                       
                {clock_count=0;}       
        }
}
#endif       


友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
15条回答
木__子、
1楼-- · 2019-07-16 21:12
生的潇洒 发表于 2013-4-28 18:37
LZ你也做电子称啊~我毕业设计都在做好了,在想怎么创新基于单片机控制的电子称~~~~ ...

能加我QQ告诉我一些关于HX711芯片需要掌握的知识点嘛
木__子、
2楼-- · 2019-07-16 21:59
木__子、 发表于 2013-6-1 15:02
能加我QQ告诉我一些关于HX711芯片需要掌握的知识点嘛

我的QQ是835651138。
ocean32
3楼-- · 2019-07-17 00:58
木__子、 发表于 2013-6-1 15:06
我的QQ是835651138。

求楼主电子称资料,谢谢
没开机
4楼-- · 2019-07-17 03:59
生的潇洒 发表于 2013-4-28 18:37
LZ你也做电子称啊~我毕业设计都在做好了,在想怎么创新基于单片机控制的电子称~~~~

跪求电子称资料,
大自然的世界
5楼-- · 2019-07-17 07:06
 精彩回答 2  元偷偷看……
123pps
6楼-- · 2019-07-17 08:59
求资料,楼主

一周热门 更多>