Guter Einwurf, war ein Fehler.
Doch nun erhalte ich den vorherigen Fehler (Error 60 , 60 und 221) mit dem Code:
Code:
$regfile = "m32def.dat"
$framesize = 32
$swstack = 256
$hwstack = 128
$crystal = 16000000
$baud = 9600
$lib "mcsbyte.lbx"
Config Pind.6 = Input
Config Rc5 = Pind.6
Portd.6 = 1
Config Pinc.2 = Output
Config Pinc.4 = Output
Config Pinc.3 = Input
'Ports für linken Motor
Config Pinb.0 = Output
Config Pinb.4 = Output
Config Pind.5 = Output
'Ports für rechten Motor
Config Pinb.1 = Output
Config Pinb.2 = Output
Config Pind.4 = Output
Config Servos = 2 , Servo1 = Portd.7 , Servo2 = Portb.3 , Reload = 10
Config Pinb.3 = Output
Config Pind.7 = Output
Enable Interrupts
Dim Address As Byte , Command As Byte
Dim Pulses As Word , Periods As Word
Pulses = 65535 : Periods = 10000
Speaker Alias Portc.2
Dim I As Integer
Declare Sub Vorwaerts
Declare Sub Rueckwaerts
Declare Sub Halt
Declare Sub Links
Declare Sub Rechts
Declare Sub These
Declare Sub Camera
Do
Portc.4 = 1
Gosub Camera
Gosub Vorwaerts
Loop
Sub Camera
Servo(2) = 95
Print "Mittelstellung"
Wait 1
Servo(1) = 95
Print "Mittelstellung"
Wait 1
End Sub
Return
Sub Vorwaerts
Do
Portb.1 = 1
Portb.2 = 0
Portb.4 = 0
Portb.0 = 1
Portd.4 = 1
Portd.5 = 1
Getrc5(address , Command)
Loop Until Pinc.3 = 0 Or Command = 11 Or Command = 12 Or Command = 13 Or Command = 14 Or Command = 15
Gosub Halt
End Sub
Return
Sub Halt
Portb.1 = 1
Portb.2 = 1
Portb.4 = 1
Portb.0 = 1
Portd.4 = 1
Portd.5 = 1
Wait 1
Getrc5(address , Command)
Waitms 150
If Command = 11 And Command = 12 And Command = 13 And Command = 14 And Command = 15 Or Command = 12 And Command = 13 And Command = 14 Then
Gosub Rueckwaerts
Elseif Command = 11 Or Command = 12 Then
Gosub Rechts
Elseif Command = 13 Or Command = 14 Or Command = 15 Then
Gosub Links
Elseif Command = 255 Then
Gosub These
End If
End Sub
Return
Sub Rueckwaerts
Portb.1 = 0
Portb.2 = 1
Portb.4 = 1
Portb.0 = 0
Portd.4 = 1
Portd.5 = 1
Waitms 500
Portb.1 = 1
Portb.2 = 1
Portb.4 = 1
Portb.0 = 1
Portd.4 = 1
Portd.5 = 1
Waitms 500
Gosub Rechts
End Sub
Return
Sub Rechts
Portb.1 = 1
Portb.2 = 0
Portb.4 = 1
Portb.0 = 0
Portd.4 = 1
Portd.5 = 1
Waitms 500
Gosub Vorwaerts
End Sub
Return
Sub Links
Portb.1 = 0
Portb.2 = 1
Portb.4 = 0
Portb.0 = 1
Portd.4 = 1
Portd.5 = 1
Waitms 500
Gosub Vorwaerts
End Sub
Return
Sub These
Portb.1 = 1
Portb.2 = 0
Portb.4 = 1
Portb.0 = 0
Portd.4 = 1
Portd.5 = 1
Waitms 500
Gosub Vorwaerts
End Sub
Return
End
Veränderung der Stack Werte bzw. framesize beheben leider nicht den Fehler.
Lesezeichen