PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Schieberegister und 7 Segm.



Mr-400-Volt
02.03.2007, 22:34
Hallo, ich habe mir eine Anzeige aus 6 mal 7-segm. aufgebaut, die mitteln schieberegister angesteuert werden. Die Anzeige ist auch ok. Aber mein Programm, welches eine beliebige Zahl (wert) ausgeben soll, zeigt nur müll an. Könnte mir da jemand helfen ?

Danke !!

$regfile "m8def.dat"
$crystal = 8000000

Config Portd = Output

Dim Z(6) As Word
Dim X As Byte , Wert As Single , Y As Byte , Wert_string As String * 6
Dim Zahl(10) As Byte
Dim H As String * 1 , C As Byte

Z(1) = &B11111111
Z(2) = &B11111111
Z(3) = &B11111111
Z(4) = &B11111111
Z(5) = &B11111111
Z(6) = &B11111111
Gosub _shiftout

Wert = 123456
Wert_string = Str(wert)

Restore Zahlen
For X = 1 To 10
Read Zahl(x)
Next





For X = 1 To 6
H = Mid(wert_string , X , 1)
C = Val(h)
Z(x) = Zahl(c)
Next

Gosub _shiftout


Do
Loop





_shiftout:
Portd.2 = 0
Shiftout Portd.0 , Portd.1 , Z(1) , 2
Shiftout Portd.0 , Portd.1 , Z(2) , 2
Shiftout Portd.0 , Portd.1 , Z(3) , 2
Shiftout Portd.0 , Portd.1 , Z(4) , 2
Shiftout Portd.0 , Portd.1 , Z(5) , 2
Shiftout Portd.0 , Portd.1 , Z(6) , 2
Portd.2 = 1
Return

Zahlen:
Data &B00000011 , &B10011111 , &B00100101 , &B00001101 , &B10011001
Data &B01001001 , &B01000001 , &B00011111 , &B00000001 , &B00001001

Mr-400-Volt
02.03.2007, 22:44
Hat sich erledigt. Habe die Variable "Z(6)" falsch deklariert.......muß ein Byte sein. Nu geht alles