标题:
for三重循环为什么不退跳出?求指点~
[打印本页]
作者:
_小古
时间:
2016-2-26 14:59
标题:
for三重循环为什么不退跳出?求指点~
#include <reg52.h>
#include "yc.h"
#include "fw.h"
#include <intrins.H>
#define uint unsigned int
#define uchar unsigned char
sbit dx=P2^0;
sbit wx=P2^1;
uchar smg[10]={0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x3f};
uchar c,a,b;
void main()
{
DU=0;
WE=0;
EN=0;
dx=1;
P0=0x3f;
dx=0;
wx=1;
P0=0x00;
wx=0;
for(c=2;c>0;c--)
{
P1=0xfe;
for(a=7;a>0;a--)
{
P1=_crol_(P1,1);
yc(5);
}
for(a=7;a>0;a--)
{
P1=_cror_(P1,1);
yc(5);
}
} //到这里就不会跳出
dx=1;
P0=0x6;
dx=0;
wx=1;
P0=0x00;
wx=0;
}
作者:
_小古
时间:
2016-2-26 15:26
发现问题了 原来后面没加延迟 数码管 0 变成1马上又0所以看不出 有变化 ,现在又个问题,这样可以前面For循环跳出一次数码管改变一个数字呢
作者:
liuzhaoxin1020
时间:
2017-1-1 12:54
不错的分享
作者:
黄煌皇
时间:
2017-1-2 20:18
你这个是三重for循环吗?不是一个for循环里面包含两个for循环吗?也就是双重for循环。
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1