Hallo,
und das ganze ohne Widerstände, wird da nix warm ?
Es lässt sich zumindest mal so zusammenfassen:
Code:
$regfile = "m8def.dat"
$crystal = 8000000
Config Portd = Output
Config Portb = Output
Dim E As Byte ' Zahl
Dim X As Byte 'Zeit (ms), wielange Kathoden ein
X = 1
Do
E = 6 'Beispielzahl Einer
Gosub E
E = 5 'Beispielzahl Zehner
Gosub Z
E = 4 'Beispielzahl Hunderter
Gosub H
E = 7 'Beispielzahl Tausender
Gosub T
Loop
End
E:
Portb.0 = 1 'Kathode Einer ein
Gosub Wertsuche
Portb.0 = 0 'Kathode Einer aus
Return
Z:
Portb.1 = 1 'Kathode Zehner ein
Gosub Wertsuche
Portb.1 = 0 'Kathode Zehner aus
Return
H:
Portb.2 = 1 'Kathode Hunderter ein
Gosub Wertsuche
Portb.2 = 0
Return 'Kathode Hunderter aus
T:
Portb.3 = 1 'Kathode Tausender ein
Gosub Wertsuche
Portb.3 = 0 'Kathode Tausender aus
Return
Wertsuche:
If E = 0 Then Gosub 0
If E = 1 Then Gosub 1
If E = 2 Then Gosub 2
If E = 3 Then Gosub 3
If E = 4 Then Gosub 4
If E = 5 Then Gosub 5
If E = 6 Then Gosub 6
If E = 7 Then Gosub 7
If E = 8 Then Gosub 8
If E = 9 Then Gosub 9
Waitms X
Return
0:
Portd = &B00111111 '0
Return
1:
Portd = &B00000110 '1
Return
2:
Portd = &B01011011 '2
Return
3:
Portd = &B01001111 '3
Return
4:
Portd = &B01100110 '4
Return
5:
Portd = &B01101101 '5
Return
6:
Portd = &B01111101 '6
Return
7:
Portd = &B00000111 '7
Return
8:
Portd = &B01111111 '8
Return
9:
Portd = &B01101111 '9
Return
evtl. eine Sub bauen, an die man den Wert und die Stelle übergibt.
Edit:
Jetzt hab ich zu schnell auf Absenden gedrückt,
ich wollte noch ja noch den Timer vorschlagen, um zB. 30mal/s die Anzeige zu aktualisieren.
Lesezeichen