So, ich hab mal das Bascom Programm abgeändert, daß es über interrupt funktioniert:
Wenn ich mich nich verlesen hab in der Hilfe, kann ich mit "Config Srevos" aber nur 2 Servos ansteuern, oder??Code:'Servo Test für VB Programm SERVO 'Befehle über RS232 / RS485 'Erstellt 30.12.2008 By Kalle 'Befehlsaufbau: 1125 ' || ' |=Servobosition ' =Servonummer $regfile = "m32def.dat" $crystal = 16000000 Config Servos = 1 , Servo1 = Portb.0 , Reload = 10 Config Portb = Output Config Serialin = Buffered , Size = 20 , Bytematch = 13 'Bytematch=13 Interrupt bei CR auslösen Enable Interrupts Declare Sub Serial0charmatch() '*** Variablendeklaration *** Dim Befehl As String * 5 Dim Nummer As String * 2 Dim Aktion As String * 3 Dim Nummerbyte As Byte Dim Aktionbyte As Byte '*** Hauptprogramm *** Do If Len(befehl) > 0 Then Print Befehl Nummer = Left(befehl , 1) Aktion = Mid(befehl , 2 , 3) Nummerbyte = Val(nummer) Aktionbyte = Val(aktion) If Aktionbyte < 50 Then Aktionbyte = 50 'Positionsbegrenzung nach unten If Aktionbyte > 150 Then Aktionbyte = 150 'Positionsbegrenzung nach oben Servo(nummerbyte) = Aktionbyte Print Nummerbyte Print Aktionbyte End If Befehl = "" Loop Sub Serial0charmatch() Input Befehl Noecho End Sub
Gruß Kalle






Zitieren

Lesezeichen