$regfile = "m32def.dat"
$crystal = 8000000
$hwstack = 60
$swstack = 60
$framesize = 60
'$sim
'Alle Ports auf digital 5V/0V setzen ausser die Eingänge der Bewegungsmelder die auf 2,6V
Ddra = &B11111111
Ddrb = &B11111111
Ddrc = &B11111111
Ddrd = &B00111111
'Alle Ports auf 0 setzen für definierten Anfangszustand
Porta = &B00000000
Portb = &B00000000
Portc = &B00000000
Portd = &B00000000
'Variablen und Subs festlegen
Declare Sub Switch_on(byval Cstart As Byte , Byval Cstop As Integer , Byval Reverse As Byte)
Declare Sub Switch_on1(byval Cstart As Integer , Byval Cstop As Integer , Byval Reverse As Byte)
Declare Sub Outputs
Declare Sub Movinglight(byval Reverse As Byte)
Declare Sub Doublemovinglight(byval Cstart As Byte , Byval Cstop As Integer , Byval Reverse As Byte)
Declare Sub Doublemovinglight2(byval Cstart As Byte , Byval Cstop As Integer , Byval Reverse As Byte)
Declare Sub Welle
Dim Ison As Bit , Isoff As Bit , S1 As Bit , S2 As Bit , S3 As Byte
Dim Wert As Bit , A As Bit , B As Bit , C As Bit
Dim Led As Integer , Leu As Integer , Leda As Byte , Ledb As Byte , Ledc As Byte
Dim Ledd As Byte , Dauer As Byte , Zwei As Byte
Dim Pwmhell As Word , Pwmdunkel As Word , Dimm As Word , Timeout As Word
Dim Pwmdunkel1 As Integer , Pwmdunkel2 As Integer , Pwmdunkel3 As Integer , Pwmdunkel4 As Integer
Dim Speedmodus1 As Word , Speedmodus2 As Word , Speedmodus3 As Word
Dim Speedmodus4 As Word , Speedmodus5 As Word , Anzahlmodus4 As Word
Dim Speedmodus6 As Word , Speedmodus7 As Word , Anzahlmodus7 As Word , Speedmodus10 As Word
Dim Z As Byte , Y As Word , X As Word , W As Byte
Dim Modus As Byte , Faktordunkel As Byte , Faktorhell As Byte
Dim Merkerdimmung As Bit , Merkerpwmdunkel As Word , Merkerpwmhell As Word , Merkerled As Integer
Dim Merker1 As Integer , Merker2 As Byte , Merker3 As Bit
Dim Timeron As Long , Timeron1 As Long , Faktortimer As Single
' Übersicht Speicherbereiche Variablen
'Dim as Bit = 0 bis 1
'Dim as Byte = 0 bis 255
'Dim as Integer = -32768 bis +32767
'Dim as Word = 0 bis 65535
'Dim as Long = -2147483648 bis 2147483647
'Dim as Single = 1,5 x 10^-45 bis 3,4 x 10^38
'Dim as Double = 5,0 x 10^-324 bis 1,7 x 10^308
'Dim as String = 254 Zeichen
'Variablen für LED Zustand (an oder aus) definieren
Ison = 0
Isoff = 1
Timeron = 0
Modus = Rnd(7) + 1
'Warte 20s bis sich bewegungsmelder beruhigt haben
Waitms 20000
'===========================================================================================
'===========================================================================================
'Programmanfang
Anfang:
'Geschwindigkeiten und Zeiten aller Modi festlegen (*µs)
Speedmodus1 = 500
Speedmodus2 = 200
Speedmodus3 = 230
Speedmodus4 = 120
Anzahlmodus4 = 180
Speedmodus5 = 300
Speedmodus6 = 250
Speedmodus7 = 1000
Anzahlmodus7 = 10
Speedmodus10 = 3000
Timeout = 0
Dauer = 100
'Zufallsgenerator für Auswahl Modus für Bewegungsmelder wenn LED aus
If Ison = 0 Then
Modus = Modus + 1
If Modus = 9 Then
Modus = 1
End If 'Rnd(7) + 1
End If
Anfangausdimmung:
Merker1 = 0
Merker2 = 0
Pwmdunkel1 = 0
Pwmdunkel2 = 0
Waitms 500 'Warten damit Funk wieder ein falls manuell gedimmt werden sollte
Do
'Zählervariablen zurücksetzen
Led = 0
Ledb = 0
Ledc = 0
Ledd = 0
Z = 0
Y = 0
X = 0
W = 0
Pwmdunkel = 0
Pwmhell = 0
Timeron = Timeron + 1 'Timer 100ms x Timeron
If Timeron > 36000 And Merkerdimmung = 0 And Pind.5 = 0 Then '100ms x 36000 = 1h
Merkerdimmung = 1
Merkerpwmhell = 500
Merkerpwmdunkel = 5000
Merkerled = 28
Goto Modus10
End If
'Abfrageschleife der Bewegungsmelder mit Abschalttimer
If Pind.7 = 1 And Pind.5 = 0 And Pind.6 = 0 And Ison = 0 Then
Goto Sw1
Elseif Pind.6 = 1 And Pind.7 = 0 And Pind.5 = 0 And Ison = 0 Then
Goto Sw2
Elseif Pind.5 = 1 And Pind.7 = 0 And Pind.6 = 0 And Ison = 0 Then
Goto Sw3
Elseif Pind.5 = 1 And Pind.7 = 0 And Pind.6 = 0 And S3 > 0 Then
Goto Sw3
Elseif Pind.5 = 0 And Pind.7 = 0 And Pind.6 = 0 And Merkerdimmung = 1 And Ison = 0 Then
Goto Modus10
End If
'Timerende prüft in welcher Richtung die Beleuchtung losgelaufen ist um in umgekehrter Richtung auszuschalten
If Timeout > Dauer And S1 = 1 And S2 = 0 And Ison = 1 Then
Goto Sw2
End If
If Timeout > Dauer And S2 = 1 And S1 = 0 And Ison = 1 Then
Goto Sw1
End If
'Reset Timer und Speichervar. für Bewegungsmelder
If Timeout > Dauer Then
Timeout = 0
S1 = 0
S2 = 0
End If
'Timer
Timeout = Timeout + 1
Led = 0
Waitms 100
Loop
End
Sw1:
'Bewegungsmelder 1 wurde dedektiert und startet anhand Ison, ob aus oder eingedimmt werdern soll
If S1 = 1 Or S3 = 1 Then
Goto Anfang
End If
'Modus 1
If Ison = 0 And Modus = 1 Then
Ison = 1
Isoff = 0
S1 = 1
Call Switch_on(0 , 28 , 0)
Elseif Ison = 1 And Modus = 1 Then
Ison = 0
Isoff = 1
S1 = 0
S2 = 0
Call Switch_on(0 , 28 , 1)
End If
'Modus 2
If Ison = 0 And Modus = 2 Then
Ison = 0
Isoff = 1
Speedmodus1 = Speedmodus2
Call Switch_on(0 , 28 , 0)
End If
'Modus 3
If Ison = 0 And Modus = 3 Then
Ison = 0
Isoff = 1
Call Switch_on1(0 , 33 , 0)
End If
'Modus 4
If Ison = 0 And Modus = 4 Then
Call Movinglight(0)
End If
'Modus 5
If Ison = 0 And Modus = 5 Then
Call Doublemovinglight(0 , 14 , 0)
End If
'Modus 6
If Ison = 0 And Modus = 6 Then
Call Doublemovinglight2(0 , 14 , 0)
End If
'Modus 7
If Ison = 0 And Modus = 7 Then
Call Welle
End If
Goto Anfang
Sw2:
'Bewegungsmelder 2 wurde dedektiert und startet anhand Ison, ob aus oder rückwärts eingedimmt werdern soll
If S2 = 1 Or S3 = 1 Then
Goto Anfang
End If
'Modus 1
If Ison = 0 And Modus = 1 Then
Ison = 1
Isoff = 0
S2 = 1
Call Switch_on(0 , 28 , 1)
Elseif Ison = 1 And Modus = 1 Then
Ison = 0
Isoff = 1
S1 = 0
S2 = 0
Call Switch_on(0 , 28 , 0)
End If
'Modus 2
If Ison = 0 And Modus = 2 Then
Ison = 0
Isoff = 1
Speedmodus1 = Speedmodus2
Call Switch_on(0 , 28 , 1)
End If
'Modus 3
If Ison = 0 And Modus = 3 Then
Ison = 0
Isoff = 1
Call Switch_on1( -5 , 28 , 1)
End If
'Modus 4
If Ison = 0 And Modus = 4 Then
Call Movinglight(1)
End If
'Modus 5
If Ison = 0 And Modus = 5 Then
Call Doublemovinglight(0 , 14 , 1)
End If
'Modus 6
If Ison = 0 And Modus = 6 Then
Call Doublemovinglight2(0 , 14 , 1)
End If
'Modus 7
If Ison = 0 And Modus = 7 Then
Call Welle
End If
Goto Anfang
Sw3:
'Funk ein alles andere aus und von hinten beginnend einschalten
If S3 = 0 Then
S3 = 1
Porta = &B00000000
Portb = &B00000000
Portc = &B00000000
Portd = &B00000000
S3 = 1
Ison = 1
Isoff = 0
Call Switch_on(0 , 28 , 0)
Else
'Wenn Funk Schon Mal An War Gehe Zur Dimmung
Goto Modus10
End If
Goto Anfang
'######################################################################
'Modus 1 und 2 für vorwärts oder rückwärts ein oder aus dimmen (mit anbleiben und ohne)
Sub Switch_on(cstart , Cstop , Reverse)
X = 0
Y = 0
W = 0
Nochmal:
If Reverse = 0 Then
Led = Cstart
Else
Led = Cstop
End If
W = Cstart
X = Cstop
X = X + 1
For Z = Cstart To Cstop
'Lege Tastverhältnis für PWM fest
Pwmdunkel = Speedmodus1 + 1
Pwmhell = 1
'Schleife für Dimmung eines LED Stripe
For Dimm = Speedmodus1 To 0 Step -1
Wert = Isoff
If S3 = 1 And Led < 7 Then
Leu = 6 - Led
Else
Leu = Led
End If
Call Outputs
Waitus Pwmdunkel
Wert = Ison
If S3 = 1 And Led < 7 Then
Leu = 6 - Led
Else
Leu = Led
End If
If Speedmodus1 = Speedmodus1 Then
Call Outputs
End If
Waitus Pwmhell
Pwmdunkel = Pwmdunkel - 1
Pwmhell = Pwmhell + 1
Next Dimm
If Speedmodus1 = Speedmodus2 Then
Call Outputs
End If
If Reverse = 0 Then
Led = Led + 1
Else
Led = Led - 1
End If
If Pind.5 = 1 And Led = -1 Then
Ison = 0
Isoff = 1
S3 = 0
Exit Sub
End If
If Pind.5 = 1 And Led = 29 And S3 = 1 Then
Goto Modus10
End If
If Pind.5 = 0 And S3 = 1 Then
Goto Anfang
End If
Next Z
Y = Y + 1
If Z = X And Y < 18 And Modus = 2 Then
Cstart = W
Goto Nochmal
End If
End Sub
Goto Anfang
'######################################################################
'Modus 3 für vorwärts oder rückwärts wischen wie Landebahn mit mehreren LEDs
Sub Switch_on1(cstart , Cstop , Reverse)
Wiederholung:
If Reverse = 0 Then
Led = Cstart
Else
Led = Cstop
End If
W = Cstart
X = Cstop
X = X + 1
For Z = Cstart To Cstop
'Lege Tastverhältnis für PWM fest
Pwmdunkel = Speedmodus3 + 1
Pwmhell = 1
'Schleife für Dimmung eines LED Stripe
For Dimm = Speedmodus3 To 0 Step -1
Wert = Isoff
Leu = Led
Call Outputs
If Led > 4 And Reverse = 0 Then
Wert = Isoff
Leu = Led - 5
Call Outputs
Elseif Led < 24 And Reverse = 1 Then
Wert = Isoff
Leu = Led + 5
Call Outputs
End If
Waitus Pwmdunkel
Wert = Ison
Leu = Led
'Call Outputs
If Led > 4 And Reverse = 0 Then
Wert = Ison
Leu = Led - 5
'Call Outputs
Elseif Led < 24 And Reverse = 1 Then
Wert = Ison
Leu = Led + 5
'Call Outputs
End If
Waitus Pwmhell
Pwmdunkel = Pwmdunkel - 1
Pwmhell = Pwmhell + 1
Next Dimm
Porta = &B00000000
Portb = &B00000000
Portc = &B00000000
Portd = &B00000000
If Reverse = 0 Then
Led = Led + 1
Else
Led = Led - 1
End If
Next Z
Y = Y + 1
If Z = X And Y < 20 And Modus = 3 Then
Cstart = W
Goto Wiederholung
End If
End Sub
Goto Anfang
'######################################################################
'Modus 4 für vorwärts oder rückwärts Lauflicht mit drei LED
Sub Movinglight
For Z = 1 To Anzahlmodus4
Y = Y + 1
If Y = 1 And Reverse = 0 Then
A = 1
B = 0
C = 0
Elseif Y = 1 And Reverse = 1 Then
C = 1
B = 0
A = 0
End If
If Y = 2 Then
A = 0
B = 1
C = 0
End If
If Y = 3 And Reverse = 0 Then
A = 0
B = 0
C = 1
Y = 0
Elseif Y = 3 And Reverse = 1 Then
C = 0
B = 0
A = 1
Y = 0
End If
'beim letzen Durchlauf alle auschalten
If Z = Anzahlmodus4 Then
A = 0
B = 0
C = 0
End If
Porta.0 = A
Porta.1 = B
Porta.2 = C
Porta.3 = A
Porta.4 = B
Porta.5 = C
Porta.6 = A
Porta.7 = B
Portb.0 = C
Portb.1 = A
Portb.2 = B
Portb.3 = C
Portb.4 = A
Portb.5 = B
Portb.6 = C
Portb.7 = A
Portc.0 = B
Portc.1 = C
Portc.2 = A
Portc.3 = B
Portc.4 = C
Portc.5 = A
Portc.6 = B
Portc.7 = C
Portd.0 = A
Portd.1 = B
Portd.2 = C
Portd.3 = A
Portd.4 = B
Waitms Speedmodus4
Next Z
End Sub
Goto Anfang
'######################################################################
'Modus 5 für in beide Richtungen wischen von Mitte aus
Sub Doublemovinglight(cstart , Cstop , Reverse)
Wiederholung1:
If Reverse = 0 Then
Led = Cstart
Else
Led = Cstop
End If
W = Cstart
X = Cstop
X = X + 1
For Z = Cstart To Cstop
'Lege Tastverhältnis für PWM fest
Pwmdunkel = Speedmodus5 + 1
Pwmhell = 1
'Schleife für Dimmung eines LED Stripe
For Dimm = Speedmodus5 To 0 Step -1
Wert = Isoff
Leu = Led
Call Outputs
If Reverse = 0 Then
Leu = Z + 14
Else
Leu = 28 - Z
End If
Call Outputs
Waitus Pwmdunkel
Wert = Ison
Leu = Led
'Call Outputs
If Reverse = 0 Then
Leu = Z + 14
Else
Leu = 28 - Z
End If
'Call Outputs
Waitus Pwmhell
Pwmdunkel = Pwmdunkel - 1
Pwmhell = Pwmhell + 1
Next Dimm
Porta = &B00000000
Portb = &B00000000
Portc = &B00000000
Portd = &B00000000
If Reverse = 0 Then
Led = Led + 1
Else
Led = Led - 1
End If
Next Z
Y = Y + 1
If Z = X And Y < 15 And Modus = 5 Then
Cstart = W
Goto Wiederholung1
End If
End Sub
Goto Anfang
'######################################################################
'Modus 6 für in beide Richtungen wischen von Mitte aus aber wie Knight Rider
Sub Doublemovinglight2(cstart , Cstop , Reverse)
Wiederholung2:
If Reverse = 0 Then
Led = Cstart
Else
Led = Cstop
End If
W = Cstart
X = Cstop
X = X + 1
For Z = Cstart To Cstop
'Lege Tastverhältnis für PWM fest
Pwmdunkel = Speedmodus6 + 1
Pwmhell = 1
'Schleife für Dimmung eines LED Stripe
For Dimm = Speedmodus6 To 0 Step -1
Wert = Isoff
Leu = Led
Call Outputs
If Reverse = 0 Then
Leu = Z + 14
Else
Leu = 28 - Z
End If
Call Outputs
Waitus Pwmdunkel
Wert = Ison
Leu = Led
'Call Outputs
If Reverse = 0 Then
Leu = Z + 14
Else
Leu = 28 - Z
End If
'Call Outputs
Waitus Pwmhell
Pwmdunkel = Pwmdunkel - 1
Pwmhell = Pwmhell + 1
Next Dimm
Porta = &B00000000
Portb = &B00000000
Portc = &B00000000
Portd = &B00000000
If Reverse = 0 Then
Led = Led + 1
Else
Led = Led - 1
End If
Next Z
Y = Y + 1
If Z = X And Y < 15 And Modus = 6 And Reverse = 0 Then
Reverse = 1
Cstart = W
Goto Wiederholung2
Elseif Z = X And Y < 15 And Modus = 6 And Reverse = 1 Then
Reverse = 0
Cstart = W
Goto Wiederholung2
End If
End Sub
Goto Anfang
'######################################################################
'Modus 7 an- und abschwellend
Sub Welle
Pwmdunkel = Speedmodus7
Merker3 = 0
Speedmodus7 = Speedmodus7 * 2
For X = 1 To Anzahlmodus7
For Y = 1 To Speedmodus7
If Merker3 = 0 Then
Pwmhell = Pwmhell + 1
Pwmdunkel = Pwmdunkel - 1
Else
Pwmhell = Pwmhell - 1
Pwmdunkel = Pwmdunkel + 1
End If
Porta = &B11111111
Portb = &B11111111
Portc = &B11111111
Portd = &B00011111
Waitus Pwmhell
Porta = &B00000000
Portb = &B00000000
Portc = &B00000000
Portd = &B00000000
Waitus Pwmdunkel
If Pwmdunkel < 2 Then
Merker3 = 1
End If
If Pwmhell < 50 Then
Merker3 = 0
End If
Next Y
Next X
End Sub
Goto Anfang
'######################################################################
'Modus 10 alle bereits leuchtenden LED dimmen
Modus10:
'Tastverhältnis und letzte angesteuerte LED an Variable übergeben und S2 auf Modus 2 setzen
S3 = 2
If Merkerdimmung = 1 Then
Pwmdunkel = Merkerpwmdunkel
Pwmhell = Merkerpwmhell
Led = Merkerled
Ison = 1
Isoff = 0
Merkerdimmung = 0
Else
Pwmdunkel = 500
Pwmhell = Speedmodus10 + 1
Ison = 1
Isoff = 0
Led = Leu
End If
Merkerdimmung = 0
If Leu > 28 Or Leu < 0 Then
S3 = 0
Ison = 0
Isoff = 1
Merkerdimmung = 0
Goto Anfang
End If
'Schleife Dimmung
Dimmung:
'Wenn Funk aus damm bleibt die gewählte Dimmstufe mit jedem aus ein kann eine stufe tiefer gedimmt werden
Faktordunkel = 1
If Pind.5 = 1 And Pwmhell > 100 Then
Faktordunkel = 5
Faktorhell = 1
Elseif Pind.5 = 1 And Pwmhell < 101 And Pwmhell > 30 Then
Faktordunkel = 10
Faktorhell = 1
Elseif Pind.5 = 1 And Pwmhell < 31 Then
Faktordunkel = 20
Faktorhell = 1
Elseif Pind.5 = 0 Or Pwmhell < 2 Then
Faktordunkel = 0
Faktorhell = 0
End If
Pwmdunkel = Pwmdunkel + Faktordunkel
Pwmhell = Pwmhell - Faktorhell
'Automatische Reduzierung
If Faktortimer > 500000000 Then '500000000µs ca. 30min
Led = Led - 1
Timeron1 = 1
If Led < 0 Then
Led = -1
End If
End If
Timeron1 = Timeron1 + 1
Faktortimer = Pwmhell + Pwmdunkel
Faktortimer = Faktortimer * Timeron1
'Warteschleife bis Funktaster aus bei max Dimmung
Warte:
'Aus Led Portmuster generieren
If Led = -1 Then
Porta = &B00000000
Elseif Led = 0 Then
Porta = &B00100000
Elseif Led = 1 Then
Porta = &B00110000
Elseif Led = 2 Then
Porta = &B00111000
Elseif Led = 3 Then
Porta = &B00111100
Elseif Led = 4 Then
Porta = &B00111110
Elseif Led = 5 Then
Porta = &B00111111
Elseif Led = 6 Then
Porta = &B01111111
Elseif Led = 7 Then
Porta = &B11111111
Elseif Led = 8 Then
Porta = &B11111111
Portb = &B00000001
Elseif Led = 9 Then
Porta = &B11111111
Portb = &B00000011
Elseif Led = 10 Then
Porta = &B11111111
Portb = &B00000111
Elseif Led = 11 Then
Porta = &B11111111
Portb = &B00001111
Elseif Led = 12 Then
Porta = &B11111111
Portb = &B00011111
Elseif Led = 13 Then
Porta = &B11111111
Portb = &B00111111
Elseif Led = 14 Then
Porta = &B11111111
Portb = &B01111111
Elseif Led = 15 Then
Porta = &B11111111
Portb = &B11111111
Elseif Led = 16 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B00000001
Elseif Led = 17 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B00000011
Elseif Led = 18 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B00000111
Elseif Led = 19 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B00001111
Elseif Led = 20 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B00011111
Elseif Led = 21 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B00111111
Elseif Led = 22 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B01111111
Elseif Led = 23 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B11111111
Elseif Led = 24 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B11111111
Portd = &B00000001
Elseif Led = 25 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B11111111
Portd = &B00000011
Elseif Led = 26 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B11111111
Portd = &B00000111
Elseif Led = 27 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B11111111
Portd = &B00001111
Elseif Led = 28 Then
Porta = &B11111111
Portb = &B11111111
Portc = &B11111111
Portd = &B00011111
End If
Waitus Pwmhell
Porta = &B00000000
Portb = &B00000000
Portc = &B00000000
Portd = &B00000000
Pwmdunkel3 = Pwmdunkel / 100
Pwmdunkel4 = Pwmdunkel / 200
If Pwmdunkel2 < Pwmdunkel3 Then
Merker1 = -pwmdunkel4
End If
If Pwmdunkel1 < 1 Then
Merker1 = Pwmdunkel4
Pwmdunkel2 = Pwmdunkel
If Led < 1 Then
Led = 0
Else
Merker2 = Rnd(28)
End If
Leu = Merker2
Wert = 1
End If
Pwmdunkel2 = Pwmdunkel2 - Merker1
Pwmdunkel1 = Pwmdunkel - Pwmdunkel2
If Pwmdunkel2 > 0 Then
Waitus Pwmdunkel2
Else
Waitus 1
End If
If Led > 0 Then
Call Outputs
End If
If Pwmdunkel1 > 0 Then
Waitus Pwmdunkel1
Else
Waitus 1
End If
'Wenn schon aus dann auf Abschalten Funksignal warten und alle LEDs aus lassen
If Pwmhell < 2 And Pind.5 = 1 Then
'Warteschleife auf Funk aus
Goto Warte
Elseif Pwmhell < 2 And Pind.5 = 0 Then
'Rücksprung zum Anfang
S3 = 0
Ison = 0
Isoff = 1
Merkerdimmung = 0
Porta = &B00000000
Portb = &B00000000
Portc = &B00000000
Portd = &B00000000
Timeron = 0
Goto Anfang
End If
If Pind.6 = 1 Then
Merkerdimmung = 1
Merkerpwmdunkel = Pwmdunkel
Merkerpwmhell = Pwmhell
Merkerled = Led
Ison = 0
Isoff = 1
S3 = 0
Porta = &B00000000
Portb = &B00000000
Portc = &B00000000
Portd = &B00000000
Goto Anfangausdimmung
End If
Goto Dimmung
'######################################################################
'Globales Programm Umwandlung Zahl in PortA-D
Sub Outputs
'Da ab PortA7 die PortsB - D genutzt werden
If Leu < 8 And Leu > -1 Then
Porta.leu = Wert
Elseif Leu > 7 And Leu < 16 Then
Ledb = Leu - 8
Portb.ledb = Wert
Elseif Leu > 15 And Leu < 24 Then
Ledc = Leu - 16
Portc.ledc = Wert
Elseif Leu > 23 And Leu < 29 Then
Ledd = Leu - 24
Portd.ledd = Wert
End If
End Sub