标题: hx711电子天平STM32程序源码 [打印本页]

作者: 火虫陌    时间: 2018-3-19 14:03
标题: hx711电子天平STM32程序源码
关于hx711的资料
display12864.c文件中的WaitBusy()函数被修改过,12864的显示可能会出现单片机复位时,没有显示,要复位很多次才有显示的问题。到最后定产品时,可以改回来,如下,把 while(GPIO_ReadInputData(DisIO) & 0x0080); 句前的注释符号去掉即可。

void WaitBusy(void)         
{
    IOInitIn();        
    GPIO_ResetBits(DisIO,RS);  //RS = 0.
    GPIO_SetBits(DisIO,RW);    //RW = 1.
    GPIO_SetBits(DisIO,EN);    //EN = 1.
//    while(GPIO_ReadInputData(DisIO) & 0x0080);
    GPIO_ResetBits(DisIO,EN);  //EN = 0;
    IOInitOut();      
}

单片机源程序如下:
  1. #include "stm32f10x.h"

  2. #include "delay.h"
  3. #include "usart1.h"
  4. #include "ad_hx711.h"
  5. #include "display12864.h"
  6. #include "transform.h"
  7. #include "alarm.h"
  8. #include "init.h"
  9. #include "mass.h"
  10. #include "key.h"

  11. int main(void)
  12. {
  13.         int i=0;
  14.                        
  15.         init();          //进行系统的初始化。
  16.        
  17.         DisStr("预热中,请等待40秒。");         //延时40秒,同时显示倒计时。
  18.         for(i=40;i>0;i--)
  19.         {         
  20.                 locate16(4,4);
  21.                 DisStr("    ");
  22.                 locate16(4,4);
  23.                 DisInt(i);
  24.                 delay_ms(1000);               
  25.         }

  26.         WriteCmd(0x01);             //清除所有显示。
  27.         locate16(1,1);
  28.         DisStr("重量:   0.00  g");  //初始化显示。
  29.                
  30.         while(1)
  31.         {
  32.                 mass();
  33.                 HandleKey();
  34.         }
  35. }


复制代码

所有资料51hei提供下载:
电子天平程序.rar (539.18 KB, 下载次数: 34)







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1