Zitat:
$crystal = 1000000
$regfile = "m16def.dat"
$baud = 2400
Config Pinb.6 = Input
Config Portc = Output
Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Prescale = 1
Config Lcdpin = Pin , Db4 = Portb.2 , Db5 = Portb.3 , Db6 = Portb.4 , _
Db7 = Portb.5 , E = Portb.1 , Rs = Portb.0
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Config Lcd = 16 * 2
Cursor Off
Cls
Dim Asd As String * 255
Dim P1 As Integer
Dim P2 As Integer
Dim P3 As Integer
Dim P4 As Integer
Dim P5 As Integer
Dim P6 As Integer
Dim P7 As Integer
Dim P8 As Integer
Dim P9 As Integer
Dim P10 As Integer
Do
If Pinb.6 = 0 Then
Locate 1 , 1
Lcd P1
Locate 1 , 5
Lcd "P1"
Locate 1 , 8
Lcd P2
Locate 1 , 12
Lcd "P2"
Locate 2 , 1
Lcd P3
Locate 2 , 5
Lcd "P3"
Locate 2 , 7
Lcd P4
Locate 2 , 11
Lcd "P4"
Locate 2 , 13
Lcd P5
Else
Locate 1 , 1
Lcd P6
Locate 1 , 5
Lcd "P6"
Locate 1 , 8
Lcd P7
Locate 1 , 12
Lcd "P7"
Locate 2 , 1
Lcd P8
Locate 2 , 5
Lcd "P8"
Locate 2 , 7
Lcd P9
Locate 2 , 11
Lcd "P9"
Locate 2 , 13
Lcd P10
End If
P6 = Getadc(0)
P7 = Getadc(1)
P8 = Getadc(2)
P9 = Getadc(3)
P10 = Getadc(4)
If P1 <> P6 Then Portc.0 = 1 Else Portc.0 = 0
If P1 = P6 Then Portc.1 = 1 Else Portc.1 = 0
If P2 <> P7 Then Portc.2 = 1 Else Portc.2 = 0
If P2 = P7 Then Portc.3 = 1 Else Portc.3 = 0
If P3 <> P8 Then Portc.4 = 1 Else Portc.4 = 0
If P3 = P8 Then Portc.5 = 1 Else Portc.5 = 0
If P4 <> P9 Then Portc.6 = 1 Else Portc.6 = 0
If P4 = P9 Then Portc.7 = 1 Else Portc.7 = 0
'ANFANG UNTERPROGRAMM
Asd = ""
Input Asd
Select Case Asd
Case "1,"
Input P1
Print P1
Case "2," 'p2 schreiben
Input P2
Print P2
Case "3," 'p3 schreiben
Input P3
Print P3
Case "4," 'p3 schreiben
Input P4
Print P4
Case "5," 'p3 schreiben
Input P5
Print P5
End Select
'ENDE UNTERPROGRAMM
Loop
End
ICH MÖCHTE DEN BEREICH WO anfang und ende unterprogramm steht in ein unterprogramm packen damit der rest einfach weiter läuft