939Views2Replies

Author Options:

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

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!
 



3 Replies

user
amendiratta (author)steveastrouk2012-07-09

Not exactly. A friend asked me this. I got it though. I made some mistakes earlier, now its working!

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)amendiratta2012-07-09

Did you use a code array to store the number pattern ? The MOVC @DPTR+A instruction is great for that.

Select as Best AnswerUndo Best Answer