请大神帮我看看是什么问题
#include<reg52.h>
#include<intrins.h>
#include<string.h>
#include<lcd.h>
#include"hx711.h"
#include"keyboard.h"
#include<intrins.h>
#include<string.h>
#include<lcd.h>
#include"hx711.h"
#include"keyboard.h"
//定义量程系数
#define idata #define RATIO 2144/1623
#define idata #define RATIO 2144/1623
//定义标识
volatile bit FlagTest=0; //定时测试标志位,每0.5秒置位,测完清零
volatile bit FlagKeyPress=0; //有键按下标志,处理完毕清零
volatile bit FlagSetPrise=0; //价格设置状态标志,设置好为1
volatile bit FlagTest=0; //定时测试标志位,每0.5秒置位,测完清零
volatile bit FlagKeyPress=0; //有键按下标志,处理完毕清零
volatile bit FlagSetPrise=0; //价格设置状态标志,设置好为1
//管脚定义
sbit LedA=P2^2;
sbit beep=P1^0;
sbit alert=P1^1;
sbit LedA=P2^2;
sbit beep=P1^0;
sbit alert=P1^1;
//显示用变量
int Counter;
uchar idata str1[6]="000000";
int i,iTemp;
int Counter;
uchar idata str1[6]="000000";
int i,iTemp;
//称重用变量
unsigned long idata FullScale; //满量程AD值/1000
unsigned long AdVal; //AD采样值
unsigned long weight; //重量值,单位g
unsigned long idata prise; //单价,长整形值,单位为分
unsigned long idata money; //总价,长整形值,单位为分
unsigned long idata FullScale; //满量程AD值/1000
unsigned long AdVal; //AD采样值
unsigned long weight; //重量值,单位g
unsigned long idata prise; //单价,长整形值,单位为分
unsigned long idata money; //总价,长整形值,单位为分
//键盘处理变量
uchar keycode;
uchar DotPos; //小数点标志及位置
uchar keycode;
uchar DotPos; //小数点标志及位置
//整形转字符串的a函数,转换范围0–65536
void int2str(int x,car* str)
{
int i=1;
int tmp=10;
while(x/tmp!=0)
{
i++;
tmp*=10;
}
tmp=x;
str[i]='\0';
while(i>1)
{
str[–i]='0'+(tem%10);
tmp/=10;
}
str[0]=tmp+'0';
}
void int2str(int x,car* str)
{
int i=1;
int tmp=10;
while(x/tmp!=0)
{
i++;
tmp*=10;
}
tmp=x;
str[i]='\0';
while(i>1)
{
str[–i]='0'+(tem%10);
tmp/=10;
}
str[0]=tmp+'0';
}
//重新找回零点,每次测量前使用
void To_Zero()
{
FullScale=ReadCount()/1000;
price=0;
}
void To_Zero()
{
FullScale=ReadCount()/1000;
price=0;
}
//显示单价,单位为元,四位整数,两位小数
void Display_Price()
{
unsigned int i,j;
display_GB2312_string(5,44," ");
i=price/100; //得到整数部分
j=price-i*100; //得到小数部分
int2str(i,str1);
//显示整数部分
if(i>=1000)
{
display_GB2312_string(5,44,str1);
} else if(i>=100)
{
display_GB2312_string(5,52,str1);
}
else if(i>=10)
{
display_GB2312_string(5,60,str1);
}
else
{
display_GB2312_string(5,68,str1);
}
//显示小数点
display_GB2312_string(5,76,".");
//显示小数部分
int2str(j,str1);
if(j<10)
{
display_GB2312_string(5,84,"0");
display_GB2312_string(5,92,str1);
}
else
{
display_GB2312_string(5,84,str1);
}
}
void Display_Price()
{
unsigned int i,j;
display_GB2312_string(5,44," ");
i=price/100; //得到整数部分
j=price-i*100; //得到小数部分
int2str(i,str1);
//显示整数部分
if(i>=1000)
{
display_GB2312_string(5,44,str1);
} else if(i>=100)
{
display_GB2312_string(5,52,str1);
}
else if(i>=10)
{
display_GB2312_string(5,60,str1);
}
else
{
display_GB2312_string(5,68,str1);
}
//显示小数点
display_GB2312_string(5,76,".");
//显示小数部分
int2str(j,str1);
if(j<10)
{
display_GB2312_string(5,84,"0");
display_GB2312_string(5,92,str1);
}
else
{
display_GB2312_string(5,84,str1);
}
}
//显示重量,单位kg,两位整数,三位小数
void Display_Weight()
{
unsigned int i,j;
display_GB2312_string(3,60," ");
//weight单位是g
i=weight/1000; //得到整数部分
j=weight-i*1000; //得到小数部分
int2str(i,str1);
if(i>=10)
{
display_GB2312_string(3,60,str1);
}
else
{
display_GB2312_string(3,68,str1); }
display_GB2312_string(3,76,".");
int2str(j,str1);
if(j<10)
else if(j<100)
{
display_GB2312_string(3,84,"0");
display_GB2312_string(3,92,str1);
}
else
{
display_GB2312_string(3,84,str1);
}
}
void Display_Weight()
{
unsigned int i,j;
display_GB2312_string(3,60," ");
//weight单位是g
i=weight/1000; //得到整数部分
j=weight-i*1000; //得到小数部分
int2str(i,str1);
if(i>=10)
{
display_GB2312_string(3,60,str1);
}
else
{
display_GB2312_string(3,68,str1); }
display_GB2312_string(3,76,".");
int2str(j,str1);
if(j<10)
else if(j<100)
{
display_GB2312_string(3,84,"0");
display_GB2312_string(3,92,str1);
}
else
{
display_GB2312_string(3,84,str1);
}
}
//显示总价,单位为元,四位整数,两位小数
void Display_Money()
{
unsigned int i,j;
display_GB2312_string(7,44," ");
if(money>999999) //超出显示量程
{
display_GB2312_string(7,44,"——-");
return;
}
else if(i>=1000)
{
display_GB2312_string(7,44,str1);
}
else if(i>=100)
{
display_GB2312_string(7,52,str1);
}
else if(i>=10)
{
display_GB2312_string(7,60,str1);
}
else
{
display_GB2312_string(7,68,str1);
}
//显示小数点
display_GB2312_string(7,76,".");
//显示小数部分
int2str(j,str1);
if(j<10)
{
display_GB2312_string(7,84,"0");
display_GB2312_string(7,92,str1);
}
else
{
display_GB2312_string(7,84,str1);
}
}
void Display_Money()
{
unsigned int i,j;
display_GB2312_string(7,44," ");
if(money>999999) //超出显示量程
{
display_GB2312_string(7,44,"——-");
return;
}
else if(i>=1000)
{
display_GB2312_string(7,44,str1);
}
else if(i>=100)
{
display_GB2312_string(7,52,str1);
}
else if(i>=10)
{
display_GB2312_string(7,60,str1);
}
else
{
display_GB2312_string(7,68,str1);
}
//显示小数点
display_GB2312_string(7,76,".");
//显示小数部分
int2str(j,str1);
if(j<10)
{
display_GB2312_string(7,84,"0");
display_GB2312_string(7,92,str1);
}
else
{
display_GB2312_string(7,84,str1);
}
}
//数据初始化
void Data_Init()
{
price=0;
DotPos=0;
beep=1;
alert=1;
}
void Data_Init()
{
price=0;
DotPos=0;
beep=1;
alert=1;
}
//管脚配置
void Port_Init()
{
void Port_Init()
{
}
//定时器0初始化
void Timer0_Init()
{
ET0=1; //允许定时器0中断
TMOD=1; //定时器工作方式选择
TL0=0x06;
TH0=0xf8; //定时器赋予初值
TR0=1; //启动定时器
}
void Timer0_Init()
{
ET0=1; //允许定时器0中断
TMOD=1; //定时器工作方式选择
TL0=0x06;
TH0=0xf8; //定时器赋予初值
TR0=1; //启动定时器
}
//定时器0中断
void Timer0_ISR(void) interrupt 1 using 0
{
TL0=0x06;
TH0=0xf8; //定时器赋予初值
void Timer0_ISR(void) interrupt 1 using 0
{
TL0=0x06;
TH0=0xf8; //定时器赋予初值
//每0.5秒钟刷新重量
Counter++;
if(Counter>=200)
{
FlagTest=1;
Counter=0;
}
}
Counter++;
if(Counter>=200)
{
FlagTest=1;
Counter=0;
}
}
//==========main program==========//
void main(void)
{
Rom_CS=1;
initial_lcd();
EA=0;
Data_Init();
Port_Init();
Timer0_Init();
//初始化完成,开中断
EA=1;
//背光
LcdA=1;
clear_screen(); //清除屏幕所有点
display_GB2312_string(1,1,"电子秤初始化…");
To_Zero();
display_GB2312_string(1,1,"电子秤初始化成功");
display_GB2312_string(3,1,"重量 kg");
display_GB2312_string(5,1,"单价 元");
display_GB2312_string(7,1,"金额 元");
Display_Price();
void main(void)
{
Rom_CS=1;
initial_lcd();
EA=0;
Data_Init();
Port_Init();
Timer0_Init();
//初始化完成,开中断
EA=1;
//背光
LcdA=1;
clear_screen(); //清除屏幕所有点
display_GB2312_string(1,1,"电子秤初始化…");
To_Zero();
display_GB2312_string(1,1,"电子秤初始化成功");
display_GB2312_string(3,1,"重量 kg");
display_GB2312_string(5,1,"单价 元");
display_GB2312_string(7,1,"金额 元");
Display_Price();
while(1)
{
//每0.5秒称重一次
if(FlagTest==1)
{
//称重,得到重量值weight,单位为g
AdVal=ReadCount();
weight=FullScale-AdVal/1000;
if(weight>0x8000)weight=0;
weight=10000*weight/FullScale;
weight=weight*RATIO;
//如果超出量程,则报警
if(weight>=10000)
{
beep=0;
alert=0;
display_GB2312_string(3,60,"——");
display_GB2312_string(7,44,"——–");
}
//如果不超量程
else
{
beep=1;
alert=1;
//显示重量值
Display_Weight();
//如果单价设定好了,则计算价格
if(FlagSetPrice==1)
{
money=weight*price/1000; //单位为分
//显示总金额
Display_Money(); }
else
{
display_GB2312_string(7,44," ");
}
//清除测试标志
FlagTest=0;
}
}
//获取按键
keycode=Getkeyboard();
//有效键值0-15
if((keyboard<16)&&(FlagKeyPress==0))
{
FlagKeyPress=1;
KeyPress(keycode);
FlagKeyPress=0;
}
delay(20);
}
}
{
//每0.5秒称重一次
if(FlagTest==1)
{
//称重,得到重量值weight,单位为g
AdVal=ReadCount();
weight=FullScale-AdVal/1000;
if(weight>0x8000)weight=0;
weight=10000*weight/FullScale;
weight=weight*RATIO;
//如果超出量程,则报警
if(weight>=10000)
{
beep=0;
alert=0;
display_GB2312_string(3,60,"——");
display_GB2312_string(7,44,"——–");
}
//如果不超量程
else
{
beep=1;
alert=1;
//显示重量值
Display_Weight();
//如果单价设定好了,则计算价格
if(FlagSetPrice==1)
{
money=weight*price/1000; //单位为分
//显示总金额
Display_Money(); }
else
{
display_GB2312_string(7,44," ");
}
//清除测试标志
FlagTest=0;
}
}
//获取按键
keycode=Getkeyboard();
//有效键值0-15
if((keyboard<16)&&(FlagKeyPress==0))
{
FlagKeyPress=1;
KeyPress(keycode);
FlagKeyPress=0;
}
delay(20);
}
}
Build target 'Target 1'
assembling STARTUP.A51…
compiling 主程序.c…
主程序.C(1): warning C500: LICENSE ERROR (R208: RENEW LICENSE ID CODE (LIC))
主程序.c(4): warning C318: can't open file 'lcd.h'
主程序.c(5): warning C318: can't open file 'hx711.h'
主程序.c(6): warning C318: can't open file 'keyboard.h'
主程序.C(24): error C129: missing ';' before 'str1'
Target not created
assembling STARTUP.A51…
compiling 主程序.c…
主程序.C(1): warning C500: LICENSE ERROR (R208: RENEW LICENSE ID CODE (LIC))
主程序.c(4): warning C318: can't open file 'lcd.h'
主程序.c(5): warning C318: can't open file 'hx711.h'
主程序.c(6): warning C318: can't open file 'keyboard.h'
主程序.C(24): error C129: missing ';' before 'str1'
Target not created
gaoyang9992006:
先把第一个警告搞定,破解激活一下软件。
前面说几个头文件都打不开,估计是因为这个。说丢失分号。看半天,没看到在哪儿丢了。看看是不是你自定义的头文件里的函数有没有丢分号的。