单片机~~用八个发光二极管实现8位二进制的累加

[复制链接]
查看11 | 回复1 | 2011-2-6 05:12:54 | 显示全部楼层 |阅读模式
具体程序如下 :
#include
#define uchar unsigned char
#define uint unsigned int
void delay(uint z);
void main()
{
uchar temp;

****temp=0xff;
while(1)
{
temp++;
P1=~temp;
delay(1000);
}*****
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
我有几个地方没看懂 那个***.....***之间的看不大明白 过程是什么样的啊??谢谢各位帮忙~~~~!!!

回复

使用道具 举报

千问 | 2011-2-6 05:12:54 | 显示全部楼层
#include "reg51.h"void delay(unsigned int ms){
unsigned chari;
while(ms--) for(i = 110; i-- ; i > 0);}//-------------------------void main(){
unsigned charabc = 0;
while(1){
P1 = abc; //在P1口外接8个LED,低电平发光.
abc++;
//加,负逻辑将显示为自减.
delay(500); //延时,供观察现象.} }
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行