PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : RS23s falsche zeichen



lanic
26.02.2006, 17:20
Hallo,

habe mal wider ein problem ich bekomme von einem mega16 über die rs232 ein String a8, b8,a10,a12 usw. da dieses ein zähler werden soll der über die 7 seg. anzeige geschwommenen bahenn anzeigt. von 2 personen geht auch alles soweit sehr gut nur.

sobalt ich a14 sende über die rs232 die aber noch nicht programirt habe sollte mein µc eigendlich wider auf ein neuen ihm bekannte befehl warten nur da verhaspelt er sich. und das machet er ntürlich auch bei allen anderen nicht angegebenen werten.

meine frage was kann ich anders machen was ist mein fehler

hir mein code



$regfile = "2313def.dat"
$crystal = 3686400
$baud = 9600
Ddrd = &B1111111
Ddrb = &B11111111

Portd = &B0000000
Portb = &B00000000


Dim A As String * 3
Dim C As Byte

Q:
C = Inkey()
If C = 0 Then
Goto B
Else
Goto Q
End If
B:
Portd.2 = 0
Portb.0 = 0
Portb.1 = 0
Portb.2 = 0
Portb.3 = 0
Portb.4 = 0
Portb.5 = 0
Portb.6 = 0
Portb.7 = 0
Portd.0 = 0
Portd.1 = 0
Portd.3 = 0
Portd.4 = 0
Portd.5 = 0
Portd.6 = 0
Input A

If A = "a2" Then
Portd.2 = 1 'an
Portd.6 = 1 'a
Portb.6 = 1 '2
Wait 2
Goto Q

Else
If A = "b2" Then
Portd.2 = 1 'an
Portd.5 = 1 'b
Portb.6 = 1 '2
Wait 2
Goto Q

Else
If A = "a4" Then
Portd.2 = 1 'an
Portd.6 = 1 'a
Portb.5 = 1 '4
Wait 2
Goto Q

Else
If A = "b4" Then
Portd.2 = 1 'an
Portd.5 = 1 'b
Portb.5 = 1 '4
Wait 2
Goto Q

Else
If A = "a6" Then
Portd.2 = 1 'an
Portd.6 = 1 'a
Portb.5 = 1 '4
Portb.6 = 1 '2
Wait 2
Goto Q

Else
If A = "b6" Then
Portd.2 = 1 'an
Portd.5 = 1 'b
Portb.5 = 1 '4
Portb.6 = 1 '2
Wait 2
Goto Q

Else
If A = "a8" Then
Portd.2 = 1 'an
Portd.6 = 1 'a
Portb.4 = 1 '8
Wait 2
Goto Q

Else
If A = "b8" Then
Portd.2 = 1 'an
Portd.5 = 1 'b
Portb.4 = 1 '8
Wait 2
Goto Q

Else
If A = "a10" Then
Portd.2 = 1 'an
Portd.6 = 1 'a
Portb.3 = 1 '10
Wait 2
Goto Q

Else
If A = "b10" Then
Portd.2 = 1 'an
Portd.5 = 1 'b
Portb.3 = 1 '10
Wait 2
Goto Q
Else

If A = "a12" Then
Portd.2 = 1 'an
Portd.6 = 1 'a
Portb.3 = 1 '10
Portb.6 = 1 '2
Wait 2
Goto Q
Else
Goto Q
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End


danke euch für eure hilfe

nico

firstspeedy
28.02.2006, 14:43
Ich gehe mal davon aus, das Du bei diesem Programmierstil, absoluter Bascom Anfänger bist. Mein Tip : arbeite Dich durch den sehr gut gemachten AVR-Bascom Kurs von Roland Walter. Guckst Du hier --->
http://rowalt.de/mc/avr/avrboard/04/avrb04.htm
So wirst Du Deine Fehler selber finden. 8)