| ??? 10/26/01 20:27 Read: times |
#16074 - LEDs and switches using 89C2051 |
Hi everyone!!!!!
I am trying to make a flashing program where diffrent flashing patterns are made depending on the switch pressed. Which expert knows how to write a program so that if all switches are off then all lights are off! If switch 1 is 1 then all leds on! If switch 2 is 1 then single lamp is moved left to right at lamp/sec! If switch 7 is 1 then state of all switches is reflected on lamps! What i do know is that we must hold a copy of lamps in A register for them to rotate. I have managed to do the following (can u check?): .org 0h start:jb p3.7,start1 ;read switch7 if1. ;flash lamps if swtch clear mov p1,#0f0h;top4 lamps on. acall delay ;wait a bit ajmp start ;go back and test switch. ;copy switches to lamps if switch set. start1: mov p1,p3 ;copy switches to lamps. sjmp start ;go back and test switch. ;delay routine of 0.2 sec delay. delay:mov r7,#0 mov r6,#0 del1:nop ;wastes time. djnz r6,del1 ;inner count loop djnz r7,del1 ;outter loop ret .end I feel i have done the hard part but have i??How do i write this as a series of tests ie: jb p1.7,reflect jb p1.2,loopon " " jb p1.0,allon ajmploop. Please help, Thank you!!! |
| Topic | Author | Date |
| LEDs and switches using 89C2051 | 01/01/70 00:00 | |
RE: LEDs and switches using 89C2051 | 01/01/70 00:00 |



