找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4429|回复: 3
打印 上一主题 下一主题
收起左侧

基于stm32的HX711电子秤全套资料 含源码 原理图 PCB

[复制链接]
跳转到指定楼层
楼主
  1. #include "LED.h"
  2. #define LED0 PCout(5)
  3. void Init_LEDpin(void)
  4. {
  5.         GPIO_InitTypeDef GPIO_InitStructure;
  6.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);         
  7.         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;                                         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;                          GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;                         GPIO_Init(GPIOA, &GPIO_InitStructure);                                                
  8.         GPIO_SetBits(GPIOC,GPIO_Pin_5);       
  9.        
  10.                 LED0 = 1;
  11. }
复制代码

智能电子秤是日常生活中经常使用的一个测重装置,它采用了电子技术,传感器技术等,测量的误差小,可以将
“精确,快速,自动”的要求很好的满足。现实生活中,在学校,市场,工厂,医院等地方都得到了广泛的推广和应用。
本设计要求以stm32为中心模板,针对电子秤的自动自重,自动处理数据,自动显示来进行设计。本系统中的数据采集模块主要负责将压力这个非电量转化为电量;信号处理模块主要负责对信号的放大和模/数转化;stm32开发板控制模块主要负责数据的进一步处理,控制端口的输出等;显示模块主要负责显示重量,单价,总价。通过对这些模块的方案选择以及硬件设计,详细的介绍了本系统是如何进行数据采集,数据处理以及显示的。
  1. #include "HX711.h"
  2. #include "delay.h"
  3. u32 HX711_Buffer;
  4. u32 Weight_Maopi;
  5. s32 Weight_Shiwu;
  6. u8 Flag_Error = 0;
  7. s32 z;
  8. #define GapValue 430
  9. void Init_HX711pin(void){
  10.         GPIO_InitTypeDef GPIO_InitStructure;
  11.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);         
  12.         GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;                                 
  13.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;                  
  14.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;               
  15.         GPIO_Init(GPIOB, &GPIO_InitStructure);                                         

  16.         //HX711_DOUT
  17.     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
  18.     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
  19.     GPIO_Init(GPIOB, &GPIO_InitStructure);  
  20. }
  21. u32 HX711_Read(void)      
  22. {
  23.         unsigned long count;
  24.         unsigned char i;
  25.         HX711_SCK=0;
  26.           count=0;
  27.                 delay_us(1);
  28.           while(HX711_DOUT);
  29.           for(i=0;i<24;i++)
  30.         {
  31.                   HX711_SCK=1;
  32.                   count=count<<1;
  33.                 delay_us(1);
  34.                 HX711_SCK=0;
  35.                   if(HX711_DOUT)
  36.                         count++;
  37.                 delay_us(1);
  38.         }
  39.          HX711_SCK=1;
  40.     count=count^0x800000;
  41.         delay_us(1);
  42.         HX711_SCK=0;  
  43.         return(count);
  44. }
  45. void Get_Maopi(void)
  46. {
  47.         Weight_Maopi = HX711_Read();        
  48. }

  49. void Get_Weight(void)
  50. {
  51.         HX711_Buffer = HX711_Read();
  52.         if(HX711_Buffer > Weight_Maopi)                        
  53.         {
  54.         Weight_Shiwu = HX711_Buffer;
  55.                 Weight_Shiwu = Weight_Shiwu - Weight_Maopi;                                
  56.                 Weight_Shiwu = (s32)((float)Weight_Shiwu/GapValue);         
  57.                         //z=(s32)((float)Weight_Shiwu/GapValue);                                                                                                               
  58.         }
  59. }
复制代码


PCB截图.jpg (1.12 MB, 下载次数: 40)

PCB截图.jpg

称重压力传感器HX711AD模块电路+程序.docx

782.88 KB, 下载次数: 81, 下载积分: 黑币 -5

HX711参考驱动程序(C51).doc

21.5 KB, 下载次数: 26, 下载积分: 黑币 -5

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:1 发表于 2018-9-17 18:30 | 只看该作者
补全工程文件即可获得100+黑币
回复

使用道具 举报

板凳
ID:420467 发表于 2018-11-14 21:19 | 只看该作者
有原理图吗
回复

使用道具 举报

地板
ID:420467 发表于 2018-11-14 21:20 | 只看该作者
有原理图吗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表