@ Jaecko:
Gute Idee, werde deinen Rat befolgen 
@ PicNick:
Ah, so ist das, in der Tat seltsam.
Der Quelltext sieht nun so aus:
Code:
$regfile = "m32def.dat"
$framesize = 32
$swstack = 32
$hwstack = 32
$crystal = 16000000
$baud = 9600
' =============================================================================
' Variablendeklaration
' =============================================================================
Dim I As Integer 'Zählvariable
Dim Servodevice As Byte 'Servoansteuerung
Dim Servocommand As Byte
Dim Servonummer As Byte
Dim Servodata As Byte
Dim Greifer As Integer 'Greiferposition
Dim Greifergelenk As Integer
Dim Mittelgelenk As Integer
Dim Hauptgelenk1 As Integer
Dim Hauptgelenk2 As Integer
' =============================================================================
' Konfiguration
' =============================================================================
Config Portb = Input 'Input1 für Taster
Config Portc = Output 'Output für LEDs
Config Portd = Input 'Input2 für Taster
Config Pind.7 = Output 'Output für Sounds
'Config Scl = Portc.0 'Ports fuer I2C-Bus
'Config Sda = Portc.1
Config Pina.0 = Output 'Kommunikation
Stepper_enable Alias Pina.0 'mit MOTCTRL
Config Pina.1 = Output
Stepper_richtung Alias Pina.1
Config Pina.2 = Output
Stepper_takt Alias Pina.2
' =============================================================================
' Statusmeldung "OK"
' =============================================================================
Sound Portd.7 , 400 , 200
Waitms 100
Sound Portd.7 , 400 , 300
Waitms 100
Sound Portd.7 , 400 , 400
Waitms 100
Sound Portd.7 , 400 , 500
Waitms 100
Sound Portd.7 , 400 , 600
Waitms 100
Sound Portd.7 , 400 , 700
Waitms 100
Sound Portd.7 , 400 , 800
Waitms 100
Sound Portd.7 , 400 , 900
Waitms 100
' =============================================================================
' Initialisierung
' =============================================================================
Portc.0 = 0 'Alle LEDs an
Portc.1 = 0
Portc.2 = 0
Portc.3 = 0
Portc.4 = 0
Portc.5 = 0
Portc.6 = 0
Portc.7 = 0
Portb.0 = 1 'Pullup-Widerstände
Portb.1 = 1
Portb.2 = 1
Portb.3 = 1
Portb.4 = 1
Portb.5 = 1
Portb.6 = 1
Portb.7 = 1
Portd.0 = 1
Portd.2 = 1
Portd.4 = 1
Portd.6 = 1
Stepper_enable = 0 'Motor aus
' =============================================================================
' Eigentliches Programm als Endlosschleife
' =============================================================================
Do
' =============================================================================
' Taster 1 nach links schwenken
' =============================================================================
If Pinb.0 = 1 Then
Portc.0 = 0
Else
Portc.0 = 1
End If
' =============================================================================
' Taster 2 nach rechts schwenken
' =============================================================================
If Pinb.2 = 1 Then
Portc.1 = 0
Else
Portc.1 = 1
End If
' =============================================================================
' Taster 3 Element 1 heben
' =============================================================================
If Pinb.4 = 1 Then
Portc.2 = 0
Else
Portc.2 = 1
End If
' =============================================================================
' Taster 4 Element 1 senken
' =============================================================================
If Pinb.6 = 1 Then
Portc.3 = 0
Else
Portc.3 = 1
End If
' =============================================================================
' Taster 5 Greifer öffnen
' =============================================================================
If Pinb.1 = 1 Then
Portc.4 = 0
Else
Portc.4 = 1
End If
' =============================================================================
' Taster 6 Greifer schließen
' =============================================================================
If Pinb.3 = 1 Then
Portc.5 = 0
Else
Portc.5 = 1
End If
' =============================================================================
' Taster 7 Element 2 heben
' =============================================================================
If Pinb.5 = 1 Then
Portc.6 = 0
Else
Portc.6 = 1
End If
' =============================================================================
' Taster 8 Element 2 senken
' =============================================================================
If Pinb.7 = 1 Then
Portc.7 = 0
Else
Portc.7 = 1
End If
' =============================================================================
' Taster 9 Greifer heben
' =============================================================================
If Pind.0 = 1 Then
'Portc.0 = 0
Else
Sound Portd.7 , 400 , 200
End If
' =============================================================================
' Taster 10 Greifer senken
' =============================================================================
If Pind.2 = 1 Then
'Portc.0 = 0
Else
Sound Portd.7 , 400 , 200
End If
' =============================================================================
' Taster 11 UNBELEGT
' =============================================================================
If Pind.4 = 1 Then
'Portc.0 = 0
Else
Sound Portd.7 , 400 , 200
End If
' =============================================================================
' Taster 12 UNBELEGT
' =============================================================================
If Pind.6 = 1 Then
'Portc.0 = 0
Else
Sound Portd.7 , 400 , 200
End If
Loop
End
Bei den Bedingungen bin ich mir nicht ganz sicher. Muss es da
heißen oder doch
?
Das mit dem Messen werde ich morgen nachholen, muss jetzt zur Arbeit.
Lesezeichen