loading

Help in asssembly programming for AT89S52 (8051) for blinking LEDs?

P3.0 has a push to on switch
P2 has 8 LEDs

I need the LEDs to blink as:
If switch is ON the Port P2 goes as:
1000 0001
1100 0011
1110 0111
1111 1111

This condition holds indefinitely until Switch is pressed again (OFF) and the Port P2 goes as:
1111 1111
1110 0111
1100 0011
1000 0001
0000 0000
This condition holds indefinitely until switch is pressed again (ON) and first conditions occurs.

Any help would be appreciated.

Thankyou!
 




Homework ?

amendiratta (author)  steveastrouk5 years ago
Not exactly. A friend asked me this. I got it though. I made some mistakes earlier, now its working!
Did you use a code array to store the number pattern ? The MOVC @DPTR+A instruction is great for that.