Tastenproblem Atmega16

OP #1017405
Lesenswert?

Hallo,

habe hier ein Tastenproblem mit einer etwas unglücklichen Pinnbelegung.

Port A 3-7 Taste 1-5 und Port C7 Tate 6

Ich habe mir jetzt asm folgenden Code einfallen lassen.
1
Taste_2:clr  templ
2
        sbic PinC,7
3
    ldi  templ,0b00100000
4
        in   temph,tastA  ;PortA 3-7
5
    andi temph,0b11111000
6
    lsr  temph ; 2 x Rechtsschieben
7
    lsr  temph
8
    lsr  temph
9
        or   templ,temph
10
    com  templ
11
    andi templ,0b00111111
12
    tst  templ
13
    mov  tast_now,templ
14
    breq Tast_null
15
    rcall Delay
16
    clr  templ
17
        sbic PinC,7
18
    ldi  templ,0b00100000
19
        in   temph,tastA  ;PortA 3-7
20
    andi temph,0b11111000
21
    lsr  temph ; 2 x Rechtsschieben
22
    lsr  temph
23
    lsr  temph
24
        or   templ,temph
25
    com  templ
26
    andi templ,0b00111111
27
        tst  templ
28
    breq Tast_null
29
    cp  tast_now,templ
30
    brne tast_null
31
        sts tast,templ
32
    ret
33
        
34

35

36

37

38
tast_null: clr templ
39
           sts tast,templ
40
       ret

im Simulator geht auch alles so wie es soll in der Praxis auch Taste 1-5 
problemlos. Nur wenn ich taste 6 (PortC,7) Drücke bleibt die Taste 
"hängen" und springt erst nach ca. 5 sec wieder auch Null (Var tast).

keine ahnung was das sein soll?

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren