??? 10/02/05 23:42 Read: times |
#101834 - try this Responding to: ???'s previous message |
Assuming he wants it to count on P0 from 0000-1001 in binary,
this program could do it. Since he is only counting to 1001, he could use a 9 MOV lines with a jmp to a delay in between them. I'm also sure this is a sloppy way to do this, as some of you don't like to use registers for variables, but I always found it to simplify things, provided you keep track of all of the one's you use. MOV A, #0 ; Use A as your variable MOV R0, #9 ; Set R0 to use as your loop, loop 9 times COUNTDOWNLOOP: ; Beginning of your loop MOV P0, A ; Outputs on Port 0 the value of Acc ADD A, 1 ; Adds 1 to Acc for next loop timedelay: ; Time delay loop MOV R1, #50 ; These two values set your time delay, increase them for more delay MOV R2, #250 loop: djnz r1, loop djnz r2, loop DJNZ R0, COUNTDOWNLOOP ; Subtract 1 from R0, and loop if its not 0 ; Once zero, the program passes this line and ends. END |
Topic | Author | Date |
Please help to generate sequence | 01/01/70 00:00 | |
I don't understand | 01/01/70 00:00 | |
Azam - two questions to clarify. | 01/01/70 00:00 | |
try this | 01/01/70 00:00 | |
Try This MO Betta. | 01/01/70 00:00 | |
na | 01/01/70 00:00 | |
Be precise!![]() | 01/01/70 00:00 | |
yeeah | 01/01/70 00:00 |