Frage zum Programmieren im Assembler
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)
Liste der Anhänge anzeigen (Anzahl: 1)
Hey Siro...
Ich arbeite eigentlich nur mit ASM Dateien...
Hmm das mit dem formatieren ist schon etwas unpraktisch :-s
Aber dank dir vielmals...Habe praktisch alle fehler beheben können...
Es lag wirklich nur an dem das ich keine Leerzeichen hatte...
Nun kan ich den Code Kompilieren und es kommen keine Fehlermeldungen...ausser das noch eine Warnung steht:
Found label after column 1. (i)...was könnte das sein?
Ich habe jetzt bei der Schleife denn Wert auf 100 gesetzt...jetzt sollten die Wartezeiten zwischen dem Auflechten der LED`s etwas länger sein...oder?
Denkst du mein Programm sollte jetz so funktionieren wie ich mir das vorgestellt habe?
Gruss und danke nochmals für deine Hilfe =D>