这汇编程序,,,那里出了死循环。。。

嶶風 2011-11-08 11:32:21
#include<reg52.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
sbit d0=P1^0;
uint x,y,z,a,mun;
uchar temp ,table[]={
0x3f/*0*/,0x06/*1*/,0x5b/*2*/,0x4f/*3*/,
0x66/*4*/,0x6d/*5*/,0x7d/*6*/,0x07/*7*/,
0x7f/*8*/,0x6f/*9*/,0x77/*a*/,0x7c/*b*/,
0x39/*c*/,0x5e/*d*/,0x79/*e*/,0x71/*f*/};
void delay(uint z);
void main()
{
EA=1;
EX0=1;
TCON=0x01;
mun=0;
temp=0xfe;
while(1)
{
wela=1;
P0=temp;
wela=0;
d0=1;
dula=1;
P0=table[mun];
dula=0;
delay(100);
mun++;
if(mun==6)
mun=0;
temp=_crol_(temp,1);
if(temp==0xbf)
temp=0xfe;
}

}
void yy0() interrupt 0
{
d0=0;delay(10);
}
void delay(uint z)
{
for(x=200;x>0;x--)
for(y=z;y>0;y--);
}


自己写的,,,,多包涵。。。。
...全文
128 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
W170532934 2011-11-09
  • 打赏
  • 举报
回复
没有写过汇编和C混合的飘过
crakme 2011-11-09
  • 打赏
  • 举报
回复
11111110
00111111
00000110
01011011
01001111
01100110

表示看不太懂这灯亮的有什么规律
crakme 2011-11-09
  • 打赏
  • 举报
回复
单片机程序一般都是死循环的
看你这程序我都没看懂啥意思
灯得状态时通过查table表得到,可是程序中有个if(mun==6) mun=0;那table[6]后面的状态是表现不出来的。
嶶風 2011-11-09
  • 打赏
  • 举报
回复
void yy0() interrupt 0
{
d0=0;delay(10);
}


这个中断呢,,,,对吗?

15,440

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧