Danke für den Tip, aber so wie ich das verstanden habe, unterstützt Bascom direkt nur 2 Servos. Mir ist das Prinzip der Servoanstuerung zwar grundsätzlich klar, ich bin aber nicht so fit mit dem Atmega, und Bascom, das ich mir jetzt auf die Schnelle zutrauen würde, eine entsprechende Ansteuerung zu basteln.

Prinzipell stelle ichs mir so vor, das die Servosteuerung in einem Timerinterrupt abgearbeitet wird und die Aplikation im Hauptprogramm läuft - sollte es aus irgendeinem Grund umgekehrt besser sein wärs natürlich auch ok.

Im Timerinterrupt müsste jeder Servo etwa alle 20ms, oder so oft nötig seine individuelle Impulsdauer verpasst bekommen.

@e-fan: Kannt Du mir ein Stück Quelltext geben, aus dem ersichtilich ist, wie Du die Servos ansteuerst?









Zitat Zitat von franzl
Hallo,
schau dir mal das Beispielprogramm an das kannst du auch auf 6-8 Servos erweitern
Code:
'-----------------------------------------------------------------------
'                         (c) 2001-2005 MCS Electronics
'                           servo.bas demonstrates the SERVO option
'-----------------------------------------------------------------------

'Servo's need a pulse in order to operate
'with the config statement CONFIG Servos we can specify how many servo's we
'will use and which port pins are used
'A maximum of 16 Servos might be used
'The SERVO statements use one byte for an interrupt counter and the TIMER0
'This means that you can not use TIMER0 anymore
'The reload value specifies the interval of the timer in uS
'Config Servos = 2 , Servo1 = Portb.0 , Servo2 = Portb.1 , Reload = 10
$regfile = "2313def.dat"

Config Servos = 1 , Servo1 = Portb.0 , Reload = 10
'as an option you can use TIMER1
'Config Servos = 2 , Servo1 = Portb.0 , Servo2 = Portb.1 , Reload = 10 , Timer = Timer1


'we use 2 Servos with 10 uS resolution(steps)

'we must configure the port pins used to act as output
Config Portb = Output

'finally we must turn on the global interrupt
Enable Interrupts

'the servo() array is created automatic. You can used it to set the
'time the servo must be on
Servo(1) = 10                                               '10 times 10 = 100 uS on
'Servo(2) = 20                                               '20 times 10 = 200 uS on
Do
Loop

Dim I As Byte
Do
 For I = 0 To 100
   Servo(1) = I
   Waitms 1000
 Next

 For I = 100 To 0 Step -1
 '  Servo(1) = I
   Waitms 1000
 Next
Loop
End