Hallo

Ich habe folgendes Problem. Ich bin Anfänger und habe mit dem Programm
Mplab im Assembler folgenden Code geschrieben (siehe unten). Ich habe
folgende Idee. Ich habe ein LED-Feld von 3x3 LED`s. Beim Betätigen eines
Tasters leuchten die LED`s durcheinander auf, wie bei einem
Zufallsgenerator. Und wenn ich den Taster wieder drücke bleibt es bei
einem LED stehen und das leuchtet dann. Aber irgendwie funktioniert es
nicht so wie ich will. Könnt ihr mir Helfen?

Gruss und Danke
Toni

Code:
#include<p18F452.inc>

org 0x20

movlw B'00000000'
movwf TRISA

movlw B'00000000'
movwf TRISB

movlw B'00010000'
movwf TRISC

Schleife

movlw B'00001000' ;LED 1
movwf PORTA

btfss PORTC, 4 
goto Variante_0
goto Variante_1

Variante_0
movlw B'10000000' ;LED 2
movwf PORTA

btfss PORTC, 4 
goto Variante_2
goto Variante_3

Variante_2
movlw B'00000001' ;LED 3
movwf PORTA

btfss PORTC, 4 
goto Variante_4
goto Variante_5

Variante_4
movlw B'00000100' ;LED 4
movwf PORTA

btfss PORTC, 4 
goto Variante_6
goto Variante_7

Variante_6
movlw B'01000000' ;LED 5
movwf PORTA

btfss PORTC, 4 
goto Variante_8
goto Variante_9

Variante_8
movlw B'00000100' ;LED 6
movwf PORTB

btfss PORTC, 4 
goto Variante_10
goto Variante_11

Variante_10
movlw B'00000010' ;LED 7
movwf PORTB

btfss PORTC, 4 
goto Variante_10
goto Variante_11

Variante_12
movlw B'00001000' ;LED 8
movwf PORTB

btfss PORTC, 4 
goto Variante_14
goto Variante_15

Variante_14
movlw B'10000000' ;LED 9
movwf PORTB

btfss PORTC, 4 
goto Variante_16
goto Variante_17

goto Schleife


Variante_1
movlw B'00001000' ;LED 1
movwf PORTC
goto Schleife

Variante_3
movlw B'01110111' ;LED 2
movwf PORTC
goto Schleife

Variante_5
movlw B'01000001' ;LED 3
movwf PORTC
goto Schleife

Variante_7
movlw B'01100101' ;LED 4
movwf PORTB
goto Schleife

Variante_9
movlw B'01001001' ;LED 5
movwf PORTC
goto Schleife

Variante_11
movlw B'01101101' ;LED 6
movwf PORTC
goto Schleife

Variante_13
movlw B'01101101' ;LED 7
movwf PORTC
goto Schleife

Variante_15
movlw B'01101101' ;LED 8
movwf PORTC
goto Schleife

Variante_17
movlw B'01101101' ;LED 8
movwf PORTC
goto Schleife

end
Code-Tags eingefügt (PicNick)