I have a problem with my scheme is not working as it was thought that the scheme is flashing LEDs and a button shoulda turn on all lights, but does not work, work only when the diode is lit first, then I have a question where the problem is that the button does not work and other diodes?! thanks
p.s I use Proteus ISIS 7 profesional for the establishment of the scheme and AVR Studi 4 for the code-writing
scheme:
ImageShack® - Online Photo and Video Hosting
code:
.include "tn2313def.inc"
.def temp = r16
.def delay1 = r17
.def delay2 = r18
.def delay3 = r19
.equ button = PA0
init:
ser temp
out ddrb,temp
out ddrd,temp
loop_do_not_blink:
ldi temp, ( 1<<button ); iesledz ieksejo R
out PORTA, temp
in temp, PINA
bst temp, button
brtc loop_blink
ldi temp,63
out portb,temp
rjmp loop_do_not_blink
loop_blink:
ldi temp, ( 1<<button ); iesledz ieksejo R
out PORTA, temp
in temp, PINA
bst temp, button
brtc loop_do_not_blink
ldi temp,1
out portb,temp
ldi delay1, 32
ldi delay2, 32
ldi delay3,32
dly1:
dec delay1
brne dly1
ldi delay1, 32
dec delay2
brne dly1
ldi delay2, 32
dec delay3
brne dly1
ldi temp, 2
out portb, temp
ldi delay1, 32
ldi delay2, 32
ldi delay3,32
dly2:
dec delay1
brne dly2
ldi delay1, 32
dec delay2
brne dly2
ldi delay2, 32
dec delay3
brne dly2
ldi temp, 4
out portb, temp
ldi delay1, 32
ldi delay2, 32
ldi delay3,32
dly3:
dec delay1
brne dly3
ldi delay1, 32
dec delay2
brne dly3
ldi delay2, 32
dec delay3
brne dly3
ldi temp, 8
out portb, temp
ldi delay1, 32
ldi delay2, 32
ldi delay3,32
dly4:
dec delay1
brne dly4
ldi delay1, 32
dec delay2
brne dly4
ldi delay2, 32
dec delay3
brne dly4
ldi temp, 16
out portb, temp
ldi delay1, 32
ldi delay2, 32
ldi delay3,32
dly5:
dec delay1
brne dly5
ldi delay1, 32
dec delay2
brne dly5
ldi delay2, 32
dec delay3
brne dly5
ldi temp, 32
out portb, temp
ldi delay1, 32
ldi delay2, 32
ldi delay3,32
dly6:
dec delay1
brne dly6
ldi delay1, 32
dec delay2
brne dly6
ldi delay2, 32
dec delay3
brne dly6
rjmp loop_blink
and here you can download scheme & code:
**broken link removed**