led chaser pattern repetiton
CALL ALLON
CLR L1
CLR L2
CLR L3
CLR L4
CALL DELAY ;delay to see leds off
CALL ALLON
CALL DELAY ;add a delay to see all leds on
Sorry sir this logic is not working, this logic has changed the pattern. like blinking pattern.
I have tried this method, it's working fine but taking too much space.
I think problem is ALLON instruction.
DESGN8: ; CALL DELAY CLR L1 CLR L2 CLR L3 CLR L4 SETB L5 SETB L6 SETB L7 SETB L8 SETB L9 SETB L10 SETB L11 SETB L12 CALL DELAY CLR L2 CLR L3 CLR L4 CLR L5 SETB L6 SETB L7 SETB L8 SETB L9 SETB L10 SETB L11 SETB L12 SETB L1 CALL DELAY CLR L3 CLR L4 CLR L5 CLR L6 SETB L7 SETB L8 SETB L9 SETB L10 SETB L11 SETB L12 SETB L1 SETB L2 CALL DELAY CLR L4 CLR L5 CLR L6 CLR L7 SETB L8 SETB L9 SETB L10 SETB L11 SETB L12 SETB L1 SETB L2 SETB L3 CALL DELAY ......... .......
sir can you code this in any other method?
[ Edited Sun Jan 31 2016, 12:21 am ]
You need to explain exactly what you want the code to do.
for example
All LEDs on for 2 seconds
All LEDs off for 1 seconds.
All LEDs on for 2 seconds.
All LEDs off for 3 seconds.
All LEDs on for 2 seconds.
You need to explain exactly what you want the code to do.
for example
All LEDs on for 2 seconds
All LEDs off for 1 seconds.
All LEDs on for 2 seconds.
All LEDs off for 3 seconds.
All LEDs on for 2 seconds.ExperimenterUK
I want...
example...
ALL LED ON
LED 1,2,3,4 OFF REST LED ON
THEN LED 2.3,4,5 OFF REST LED ON
THEN LED 3,4,5,6 OFF REST LED ON
......... LIKE THIS.
after removing ALLON instruction it's working fine, so what can be alternet way by using less memory.
[ Edited Sun Jan 31 2016, 01:19 am ]
after removing ALLON instruction it's working fine, so what can be alternet way by using less memory.sankalp_s
Earlier in the thread I suggested using tables to create the output.
I think that is the best method, but good use of sub routines
will save a lot of code.
Build long patterns from shorter patterns.
but good use of sub routines
will save a lot of code.....
&
Build long patterns from shorter patterns....ExperimenterUK
Sir I didn't understand that. Could you explain above lines in different way?
and 2nd question is, can we look more to rectify the existing code?or should be dump?
thank u sir
[ Edited Wed Feb 03 2016, 12:59 am ]
Sir I didn't understand that. Could you explain above lines in different way?sankalp_s
Create short runs that turn LEDs on or off.
Then stick them together to form complicated patterns.
eg
OFF4: ;turn LEDS off 1 at a time CLR L1 CALL DELAY CLR L2 CALL DELAY CLR L3 CALL DELAY CLR L4 CALL DELAY ret ON4: ;turn LEDS on 1 at a time SETB L1 CALL DELAY SETB L2 CALL DELAY SETB L3 CALL DELAY SETB L4 SETB DELAY ret ;next section does a lot with very little extra code FIRSTLOOP: call ON4; call OFF4; call ON4: call OFF4; call ON4: call OFF4; call ON4: call OFF4; ret ;next code does 4 times as much with hardly any more code call FIRSTLOOP: call FIRSTLOOP: call FIRSTLOOP: call FIRSTLOOP:
and 2nd question is, can we look more to rectify the existing code?or should be dump?sankalp_s
If you want to keep creating new sequences, then I would dump your
code and use tables to control the patterns.
If you just want to get your display working
fix the code you have.
There should be enough memory for a good display if you
re-use the sequences as I described above.
[ Edited Sat Feb 13 2016, 04:36 am ]
now plz tell me how to add next pattern, can give me example with 2 pattern, it will be very help full to learn.
second thing is how can i design table for more pettern,
for example,
pattern1:
0,0,1,1,1,1,1,1,1,1,1,1
1,0,0,1,1,1,1,1,1,1,1,1
1,1.0,0,1,1,1,1,1,1,1,1
......
.....
where 0= led off
1 = led on
please give some example to create different pattern.
and last one. how can i use that mode function with this table method.
thank you sir.
Try this program.
Let me know if it makes sense to you.
ExperimenterUK
Thank you very much sir this program is easy to understand and learn also, now i can understand display pattern.
But i have some queries:-
I) how can i write design pattern in this way eg. db 1,0,2,0,4.....
II)mirrorbyte instruction is not working(it display only in one direction), can we use mirrorbyte instruction for separate design and why we r using of long delay in the code?
III)no of repetition of pattern like this instruction.
MOV R3, #05 ;REPEtion of pattern D9: CALL DESGN9 DJNZ R3,D9
and
MOV R3, #12 D8: CALL DESGN8 JNB P3.5,D8(how to use this) DJNZ R3,D8
[ Edited Mon Feb 15 2016, 11:36 pm ]
Thank you very much sir this program is easy to understand
and learn also, now i can understand display pattern.sankalp_s
Great..
I) how can i write design pattern in
this way eg. db 1,0,2,0,4.....sankalp_s
Your pattern is 12 bits wide, so work in rows of 16 bits
The lines below are the same.
dw 1111111100000000b dw 0ff00h db 0ffh,0h db 255,0
II)mirrorbyte instruction is not working
can we use mirrorbyte instruction for separate design
and why we r using of long delay in the code?sankalp_s
I have attached a program that does mirroring.
The long delay is just to separate the sequences.
III)no of repetition of pattern like this instruction.
MOV R3, #05 ;REPEtion of pattern D9: CALL DESGN9 DJNZ R3,D9
It is just a case adding loops to the code,
I'm sure you will work it out.