程序又有问题了,求解答
单片机吧
全部回复
仅看楼主
level 8
热爱beyond 楼主
TEXT1.C(33): error C267: 'delay': requires ANSI-style prototype,怎样解决?
2014年04月05日 05点04分 1
level 12
看看第33行有什么语法错误
2014年04月05日 05点04分 2
delay(555);就是调用一个简单的延时函数啊
2014年04月05日 06点04分
level 12
括号里面的参数超出范围了?
2014年04月05日 06点04分 3
没有啊,你看看下面,我已经复制过来了
2014年04月05日 07点04分
level 12
吧源码发出来看看
2014年04月05日 06点04分 4
level 8
常见的错误。调用函数前没有定义函数。
2014年04月05日 07点04分 5
你的单片机运行一下这个程序是怎么样的呢?我得运行出来有问题,你能试试么》?我怀疑是我的数码管出问题了
2014年04月05日 09点04分
level 8
也就是说,delay 没有定义。
2014年04月05日 07点04分 6
定义了的啊,前置声明
2014年04月05日 07点04分
回复 热爱beyond : 写错了 一个个大声读一遍
2014年04月05日 08点04分
回复 热爱beyond : 声明里没参数
2014年04月05日 08点04分
level 8
热爱beyond 楼主
#include<reg52.h>
sbit duan_latch=P2^2;
sbit wei_latch=P2^3;
void delay();
main()
{
unsigned char weima[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char duanma[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
unsigned int i;
while(1)
{
for(i=0;i<8;i++)
{
P1=weima[i];
wei_latch=1;
duan_latch=0;
P1=duanma[i];
duan_latch=1;
duan_latch=0;
delay(555);
}
}
}
void delay(unsigned int j)
{
unsigned int i=0;
for(i=0;i<j;i++);
}
2014年04月05日 07点04分 7
level 12
前置申明加上参数试试,我为了方便,一般前面写所有的子函数,主函数最后写。
2014年04月05日 07点04分 8
还真的是也。。。。。谢了哈
2014年04月05日 09点04分
level 10
。。 。这么懒的楼主
2014年04月05日 19点04分 9
为什么懒啊?没有懒啊
2014年04月06日 02点04分
level 10
这么明显的错误就是不自己去仔细研究一下src.baidu.com/forum/pic/item/6f465b43fbf2b21163a05ce2c88065380dd78e0b.jpg" pic_ext="jpeg" width="380" height="600">pic_type="0" >
渣渣属性
2014年04月06日 03点04分 10
额,这个需要经验吧,而且这个我研究了的,还是没研究出来,没得你聪明啊
2014年04月06日 04点04分
回复 热爱beyond :有c语言基础没
2014年04月06日 07点04分
回复 热爱beyond :有你就一步一步模拟运行,看看哪错了,一开始会有点难,但是多试几次以后你一眼就能看出来错在哪了
2014年04月06日 07点04分
回复 woshisbszy :就是有些概念不清楚
2014年04月06日 07点04分
level 7
dely括号里面要有参数属性
2014年04月06日 03点04分 11
嗯,知道了
2014年04月06日 04点04分
level 7
看不懂c[不高兴]
2014年04月06日 07点04分 13
1