[an error occurred while processing this directive]
|
skan_key:
rcall status_key
breq end_skan
rcall delay_20ms
rcall status_key
breq end_skan
in tempA,portkey ;
andi tempA,0b00000011 ; выход если нажаты две кл
breq end_skan ;
clr countA
ldi tempB,0b11110111
s_k1: ldi tempA,0b00001111
and tempA,tempB
out portlcd,tempA
rcall delay100
in tempA,portkey
andi tempA,0b00000011
cpi tempA,0b00000011
brne s_k2
inc countA
lsr tempB
brsh end_skan
rjmp s_k1
s_k2: inc countA
dec tempA
breq s_k4
ldi tempA,4
add countA,tempA
s_k4: rcall status_key
brne s_k4
rcall delay_20ms
rcall status_key
brne s_k4
s_k3: mov tempA,countA
tst tempA
ret
end_skan: clr tempA
ret
status_key:
clr tempA ; статус клавы
out portlcd,tempA ; z=0 - клавиша нажата
in tempA,portkey ; z=1 - клавиша не нажата
andi tempA,0b00000011
cpi tempA,0b00000011
ret
E-mail: info@telesys.ru