Home 80518051 Code LED count down

LED count down

This is a hexadecimal counter using LEDs. It will start at 0xFF and count down 1

 

Code

#include <reg52.h>

void delay(unsigned int i);
main()
{
unsigned char Num = 0xff;

while (1)
{
P2 = Num;
delay(1000);
Num–;
}

}

 

void delay(unsigned int i)
{
unsigned char j;
for(i; i > 0; i–)
for(j = 255; j > 0; j–);

}

You may also like