完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
[size=18.6667px]#include [size=18.6667px]#include [size=18.6667px]#include [size=18.6667px]#include "lcd.h" [size=18.6667px]#include "hx711.h" [size=18.6667px]#include "keyboard.h" [size=18.6667px] [size=18.6667px]//定义量程系数 [size=18.6667px]#define RAtiO 2114/1623 [size=18.6667px]//定义标识 [size=18.6667px]volatile bit FlagTest = 0; //定时测试标志,每0.5秒置位,测完清0 [size=18.6667px]volatile bit FlagKeyPress = 0; //有键按下标志,处理完毕清0 [size=18.6667px]volatile bit FlagSetPrice = 0; //价格设置状态标志,设置好为1。 [size=18.6667px] [size=18.6667px]//管脚定义 [size=18.6667px]***it LedA = P2^2; [size=18.6667px]***it beep = P1^0; [size=18.6667px]***it alert = P1^1; [size=18.6667px] [size=18.6667px]//显示用变量 [size=18.6667px]int Counter; [size=18.6667px]uchar idata str1[6] = "000000"; [size=18.6667px]int i, iTemp; [size=18.6667px]//称重用变量 [size=18.6667px]unsigned long idata FullScale; //满量程AD值/1000 [size=18.6667px]unsigned long AdVal; //AD采样值 [size=18.6667px]unsigned long weight; //重量值,单位g [size=18.6667px]//键盘处理变量 [size=18.6667px]uchar keycode; [size=18.6667px]uchar DotPos; //小数点标志及位置 [size=18.6667px] [size=18.6667px]//整型转字符串的函数,转换范围0--65536 [size=18.6667px]void int2str(int x, char* str) [size=18.6667px]{ [size=18.6667px] int i=1; [size=18.6667px] int tmp=10; [size=18.6667px] while(x/tmp!=0) [size=18.6667px] { [size=18.6667px] i++; [size=18.6667px] tmp*=10; [size=18.6667px] } [size=18.6667px] tmp=x; [size=18.6667px] str=' |
