这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » DIY与开源设计 » 电子DIY » 查找程序错误

共7条 1/1 1 跳转至

查找程序错误

助工
2014-03-30 12:56:41     打赏

下面是我编写的程序,编译连接都没有错误,但是下载到单片机(STC125A60S2)却无法执行,求原因?

#include<STC12.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar temp;
sbit D1=P1^0;
void delay(uint);

void main()
{
 while(1)
 {
  temp=0xfe; 
  D1=temp;
  temp=_crol_(temp,1);
  delay (500);
 }
}

void delay(uint y)
{
 uint x,z;
 for(x=100;x>0;x--)
  for(z=y;z>0;z--);
}

 




关键词: 程序     错误    

院士
2014-03-30 22:38:03     打赏
2楼
temp=0xfe;
把这句放在while(1)的前面再试试……

助工
2014-03-30 22:54:23     打赏
3楼
还是不行

助工
2014-03-30 22:54:57     打赏
4楼
还是不行呀!

助工
2014-03-31 10:09:41     打赏
5楼
谢了,已经搞定了

院士
2014-03-31 17:20:21     打赏
6楼
怎么搞定的啊!与大家分享一下吧!

助工
2014-04-01 22:55:11     打赏
7楼
错误有点多: 1.把sbit D1=P1^0;语句删掉 2.头文件应该小写 3.D1改为P1

共7条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]