Google

Tuesday, June 17, 2008

DANCING LEDs







C programe

#include
#define first P1
#define second P2
//sbit first P1^0
//sbit second P2^0
void wait()
{
int i,j;
for(i=0;i<=1000;i++)
for(j=0;j<=10;j++);
}
main()
{
unsigned int i; /* Delay var */
unsigned char j,m; /* LED var */
while (1)
{
for(m=0x01;m!=0xff;m=m(m<<1))
{
for(i=1;i<=7;i++)
{ /* Loop forever */
for (j=m; j!= 0x00; j<<=i) { /* Blink LED 0, 1, 2, 3, 4, 5, 6 */
P1 = j; /* Output to LED Port */
wait (); /* call wait function */
}
P1=0;
for (j=m; j!=0x00; j<<=i) { /* Blink LED 6, 5, 4, 3, 2, 1 */
P2 = j; /* Output to LED Port */
wait ();
} /* call wait function */
P2=0;
}
}
}
}

Hex code

:0300000002007784
:0C007700787FE4F6D8FD758108020003D4
:10005A00E4FFFEE4FDFC0DBD00010CED640B4C70E9
:0C006A00F50FBF00010EBE03EABFE9E77E
:010076002267
:10000300750801E508F460F87B017A00A908E96046
:1000130014F59012005AAF03E9A807088002C3330E
:10002300D8FCF980E9E4F590A908E96014F5A01279
:10003300005AAF03E9A807088002C333D8FCF9804C
:10004300E9E4F5A00BBB00010AEB64084A70BDE5C7
:070053000825E0420880AC23
:00000001FF



for further details please contact sekhar 9490081918 Email: sekharstuff@gmail.com

No comments: