| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 600 人关注过本帖
标题:各位大哥大姐,小弟遇到程序问题,弄了几天弄不明白,求好心人帮忙
只看楼主 加入收藏
lqgyln
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2015-4-5
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
各位大哥大姐,小弟遇到程序问题,弄了几天弄不明白,求好心人帮忙
duanluqi.c(10): error C141: syntax error near 'date', expected ')'
duanluqi.c(11): error C129: missing ';' before 'code'
#include<reg52.h>
#include<LCD_DESPLAY.h>
#include<ATT7022.h>
sbit SIG=P1^4;
sbit KEY=P2^0;
sbit been=P2^2;
sbit SWTCH_A=P3^0;
sbit SWTCH_B=P3^1;
sbit SWTCH_C=P3^2;
void chaifen(uchar date);
uchar code table[]={"123456789."};
uchar code table1[]={" I num  %"};
uchar screen_num=1,SWITCH_A_NUM=0,SWITCH_B_NUM=0,SWITCH_C_NUM=0;
uchar SWITCH_A_S=0,SWITCH_B_S=0,SWITCH_C_S=0;
uchar j=0,I_ding=5,SWITCH_S=15;
ulong a,b,c;
uchar Ia=0,Ib=0,Ic=0;
void SCAN()
{
if(KEY==0)
{delay(5);
if(KEY==0)
{screen_num++;
while(!KEY) ;
}
}
if(screen_num==4)
screen_num=1;
}
void chaifen(uchar date)
{
uchar bai=0,shi=0,ge=0,qian=0;
 write_com(add);
qian=date/1000;
bai=date%1000/100;
shi=date%100/10;
ge=date%10;
write_data(table[bai]);
delay(1);
write_data(table[shi]);
delay(1);
if(j==1)
{
write_data(table[10]);
delay(1);
}
write_data(table[ge]);
delay(1);
}
uchar jisuan(uchar I,uchar num)
{
uchar SWITCH_N_S;
SWITCH_N_S=(I_ding*SWITCH_S-I*I*num)* 100/(I_ding*SWITCH_S);
return SWITCH_N_S;
}
void main()
{
EA=l;
EX0=l;
TCON=0x01;
init();
write_com(0x80);
for(i=0;i<16;i++)
{
write_data(table1[i]);
delay(1);
}
delay(10);
check();
while(SIG==0);
while(l)
{SCAN();
if(screen_num==1)
{
write_com(0x80);
write_data('A')
a=read_7022(0x10);
Ia=(a/8192);
delay(l);
j=l;
write_com(0xc3);
chaifen(Ia*10);
j=0;
write_com(0xc8);
chaifen(SWITCH_A_NUM);
SWITCH_A_S=jisuan(Ia,SWITCH_A_NUM);
write_com(0xcC);
chaifen(SWITCH_A_S);
if(SWITCH_A_S<20||SWITCH_A_NUM>15)
been=0;
else
been=1;
}
if(screen_num==2)
{
write_com(0x80);
write_data('B')
b=read_7022(0x11);
Ib=(uchar)(a/8192);
delay(l);
j=l;
write_com(0xc3);
chaifen(Ib*10);
j=0;
write_com(0xc8);
chaifen(SWITCH_B_NUM);
SWITCH_B_S=jisuan(Ib,SWITCH_B_NUM);
write_com(0xcC);
chaifen(SWITCH_B_S);
if(SWITCH_B_S<20)
been=0;
else
been=1;
}
if(screen_num==3)
{
write_com(0x80);
write_data('C')
c=read_7022(0x12);
Ic=(uchar)(a/8192);
delay(1);
j=l;
write_com(0xc3);
chaifen(Ic*10);
j=0;
write_com(0xc8);
chaifen(SWITCH_C_NUM);
SWITCH_C_S=jisuan(Ic,SWITCH_C_NUM);
write_com(0xcC);
chaifen(SWITCH_A_S);
if(SWITCH_C_S<20)
been=0;
else
been=1;
}
delay(50);
}
}

void enter0() interrupt 0
{
SWITCH_A_NUM++;
}
#define uchar unsigned char
#define uint unsigned int
sbit RS=P2^0;
sbit RW=P2^1;
sbit EN=P2^2;
void delay(uint x)
{
unsigned int b,c;
for(c=x;c>0;c--)
for(b=110;b>0;b--)
}
void write_com(uchar a)
{
RS=0;
P0=a;
delay(5);
EN=l;
delay(5);
EN=0;
}
void write_data(uchar date)
{
RS=l;
P0=date;
delay(5);
EN=l;
delay(5);
EN=0;
}
void init()
{
RW=0;
EN=0;
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
write_com(0x80);
}
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long int
sbit CS=P1^0;
sbit SCLK=P1^1;
sbit DIN=P1^2;
sbit DOUT=P1^3;
uchar i;
ulong read_7022(uchar com)
{
long dat=0;uchar h;
CS=l;
SCLK=0;
CS=0;
delay(l);
for(i=0;i<8;i++)
{
SCLK=l;
delay(l);
if(com&0x80)
DIN=l;
else
DIN=0;
SCLK=0;
com=com<<1;
delay(1);
}
delay(5);
for(i=0;i<24;i++)
{
dat=dat<<1;
SCLK=l;
delay(l);
if(DOUT==1)
{
dat=dat|0x01;}
delay(1);
SCLK=0;
}
delay(1);
CS=1;
return dat;
}
void write_7022(uchar com,ulong dat)
{
CS=l;
SCLK=0;
CS=0;
delay(l);
for(i=0;i<8;i++)
{
SCLK=l;
delay(l);
if(com&0x80)
DIN=l;
else
DIN=0;
SCLK=0;
com=com<<1;
delay(1);
}
for(i=0;i<24;i++)
{
SCLK=l;
delay(l);
if( dat&0x00800000)
DIN=1;
else
DIN=0;
SCLK=0;
dat<<=l;
delay(l);

delay(2);
}
CS=1;
delay(1);
}
void check()
{
write_7022(0xc3,0x000000);//清校表数据
write_7022(0xc9,0x000000);//校表数据写使能
//-----------------------------------
//5760000000*0.648*0.648*0.5*0.1/(220*1.5*3200)=34=22H
write_7022(0x20,0x000072);//脉冲常数3200(默认值)
//-------------------------
 write_7022(0x1E,0x000000);//单点补偿 比差补偿区域设置
 //------------------------------------------
write_7022(0x02,0x000000);//相位补偿区域设置1
write_7022(0x03,0x000000);//相位补偿区域设置2
write_7022(0x04,0x000000);//相位补偿区域设置3
write_7022(0x05,0x000000);//相位补偿区域设置4
//------------------设置合相能量累加模式
write_7022(0x2A,0x000000);
//--------------------------
 write_7022(0x86,12293737);//A相功率增益0? pa
write_7022(0x89,12293737);//A相功率增益1
//-------------------------
write_7022(0x87,9277740);//B相功率增益0? pb
write_7022(0x8A,9277740);//B相功率增益1
//-------------------------
write_7022(0x88,9438312);//C相功率增益0? pc
write_7022(0x8B,9538312);//C相功率增益1
//-------------------------
write_7022(0x9B,7381975);//A相电压校正
//-------------------------
write_7022(0x9C,1006951);//B相电压校正
//-------------------------
write_7022(0x9D,71697);//C相电压校正,x
//-------------------------
write_7022(0xa6,8880843);//A相电流校正
//-------------------------
write_7022(0xa7,8476057);//B相电流校正
//-------------------------
write_7022(0xa8,8503241);//C相电流校正
//-------------------------
 write_7022(0x2c,0x000003); //温度/第七路ADC选择控制
write_7022(0xb0,0x5678);//电流相序检测时能
write_7022(0xae,0x3584);
//------------------关闭写校表使能
write_7022(0xc9,0x000001);
//---------------读电参数使能??
write_7022(0xc6,0x000011);
}
搜索更多相关主题的帖子: expected include before 
2015-04-05 11:01
诸葛欧阳
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:流年
等 级:贵宾
威 望:82
帖 子:2790
专家分:14619
注 册:2014-10-16
收藏
得分:20 
这么长的程序在手机上帮不了你,等大神吧。不过你自称小弟为什么标志是女的

一片落叶掉进了回忆的流年。
2015-04-05 12:15
lqgyln
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2015-4-5
收藏
得分:0 
回复 2楼 诸葛欧阳
好的,还是谢谢你,可能那时候注册没注意吧
2015-04-05 16:31
快速回复:各位大哥大姐,小弟遇到程序问题,弄了几天弄不明白,求好心人帮忙
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016927 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved