Seite 3 von 9

Re: Propeller im Quadrocopter

Verfasst: So 7. Okt 2012, 23:14
von PIC18F2550
Habe mal ein paar Teile ins WIKI geschoben.
Besser so :mrgreen:

Re: Propeller im Quadrocopter

Verfasst: Do 11. Okt 2012, 09:26
von PIC18F2550
Als Ausgabe an die Motore will ich erst ein mal ein paar Servos nutzen.
Nicht das ich gleich alles wieder Schrotte.

Habe dazu eine interessante routine gefunden und auf 4 Servo's aufgebohrt.

Irgend wie sieht mir der umgang mit den nicht benutzten Pinns nicht gut aus.
Werd da wohl etwas ändern müssen.

Code: Alles auswählen

DAT

Servos        org                         'Assembles the next command to the first cell (cell 0) in the new cog's RAM
Loop          mov       dira,ServoPin1    'Set the direction of the "ServoPin1" to be an output (and all others to be inputs)
              rdlong    HighTime,p1       'Read the "position1" variable from Main RAM and store it as "HighTime"
              mov       counter,cnt       'Store the current system clock count in the "counter" cell's address
              mov       outa,AllOn        'Set all pins on this cog high (really only sets ServoPin1 high b/c rest are inputs)
              add       counter,HighTime  'Add "HighTime" value to "counter" value
              waitcnt   counter,0         'Wait until cnt matches counter (adds 0 to "counter" afterwards)
              mov       outa,#0           'Set all pins on this cog low (really only sets ServoPin1 low b/c rest are inputs)

              mov       dira,ServoPin2    'Set the direction of the "ServoPin2" to be an output (and all others to be inputs)
              rdlong    HighTime,p2       'Read the "position2" variable from Main RAM and store it as "HighTime"
              mov       counter,cnt       'Store the current system clock count in the "counter" cell's address
              mov       outa,AllOn        'Set all pins on this cog high (really only sets ServoPin2 high b/c rest are inputs)
              add       counter,HighTime  'Add "HighTime" value to "counter" value
              waitcnt   counter,0         'Wait until cnt matches counter (adds 0 to "counter" afterwards)
              mov       outa,#0           'Set all pins on this cog low (really only sets ServoPin2 low b/c rest are inputs)

              mov       dira,ServoPin3    'Set the direction of the "ServoPin3" to be an output (and all others to be inputs)
              rdlong    HighTime,p3       'Read the "position3" variable from Main RAM and store it as "HighTime"
              mov       counter,cnt       'Store the current system clock count in the "counter" cell's address
              mov       outa,AllOn        'Set all pins on this cog high (really only sets ServoPin3 high b/c rest are inputs)
              add       counter,HighTime  'Add "HighTime" value to "counter" value
              waitcnt   counter,0         'Wait until cnt matches counter (adds 0 to "counter" afterwards)
              mov       outa,#0           'Set all pins on this cog low (really only sets ServoPin3 low b/c rest are inputs)

              mov       dira,ServoPin4    'Set the direction of the "ServoPin4" to be an output (and all others to be inputs)
              rdlong    HighTime,p4       'Read the "position4" variable from Main RAM and store it as "HighTime"
              mov       counter,cnt       'Store the current system clock count in the "counter" cell's address
              mov       outa,AllOn        'Set all pins on this cog high (really only sets ServoPin3 high b/c rest are inputs)
              add       counter,HighTime  'Add "HighTime" value to "counter" value
              waitcnt   counter,LowTime   'Wait until "cnt" matches "counter" then add a 10ms delay to "counter" value
              mov       outa,#0           'Set all pins on this cog low (really only sets ServoPin4 low b/c rest are inputs)

              waitcnt   counter,0         'Wait until cnt matches counter (adds 0 to "counter" afterwards)
              jmp       #Loop             'Jump back up to the cell labled "Loop"

'Constants and Variables:
ServoPin1     long      |<      4 '<------- This sets the pin that outputs the first servo signal (which is sent to the white
                                          ' wire on most servomotors). Here, this "6" indicates Pin 6. Simply change the "6"
                                          ' to another number to specify another pin (0-31).
ServoPin2     long      |<      5 '<------- This sets the pin that outputs the second servo signal (could be 0-31).
ServoPin3     long      |<      6 '<------- This sets the pin that outputs the third servo signal (could be 0-31).
ServoPin4     long      |<      7 '<------- This sets the pin that outputs the third servo signal (could be 0-31).
p1            long      0                 'Used to store the address of the "position1" variable in the main RAM
p2            long      0                 'Used to store the address of the "position2" variable in the main RAM
p3            long      0                 'Used to store the address of the "position2" variable in the main RAM
p4            long      0                 'Used to store the address of the "position2" variable in the main RAM
AllOn         long      $FFFFFFFF         'This will be used to set all of the pins high (this number is 32 ones in binary)
LowTime       long      800_000           'This works out to be a 10ms pause time with an 80MHz system clock. If the
                                          ' servo behaves erratically, this value can be changed to 1_600_000 (20ms pause)
counter       res                         'Reserve one long of cog RAM for this "counter" variable
HighTime      res                         'Reserve one long of cog RAM for this "HighTime" variable
              fit                         'Makes sure the preceding code fits within cells 0-495 of the cog's RAM

Re: Propeller im Quadrocopter

Verfasst: Do 11. Okt 2012, 12:31
von PIC18F2550
Habe jetzt meine Sensoren zum Turm zusammengelötet und siehe da es geht ohne Probleme.
WIKI korrigiert: http://hive-project.de/wiki/sen_beschl_adxl345:start
DSCI0219.JPG
DSCI0220.JPG
1. Servo am PROP :mrgreen:
DSCI0218.JPG

Re: Propeller im Quadrocopter

Verfasst: Fr 12. Okt 2012, 00:06
von PIC18F2550
komme irgendwie nicht weiter :oops:

Re: Propeller im Quadrocopter

Verfasst: Sa 13. Okt 2012, 23:23
von PIC18F2550
Hatte garnichts mit Programm zu tun.

Zwei der Conrad-Servos wahren einfach neu und schon fest. ÄRGERLICH :evil:
2012-10-14_00-13-37_685.jpg
an der Stelle wo die schraube ist fehlt jetzt ein Zahn. Der blockierte den Servo.

Den 2. konne ich als Ersatzteilspender missbrauchen für den 1.

Im Anhang das Servotestprogramm für 4 Servos
4servo_asm.spin
(5.97 KiB) 615-mal heruntergeladen

Re: Propeller im Quadrocopter

Verfasst: So 14. Okt 2012, 10:03
von drohne235
Bei beiden Servos der gleiche Fehler? Du bist ein echter Glückspilz... ;)

Re: Propeller im Quadrocopter

Verfasst: So 14. Okt 2012, 10:09
von PIC18F2550
Nicht ganz beim andern war es der Motor :evil: der dreht sich nur ein stückchen hinn und zurück.

Servo Typ:VSD-6

:oops: wenn ich blos wüsste wo ich mein GPS-Empfänger verschlampt habe könnte ich jetzt weiter machen. :evil:

Re: Propeller im Quadrocopter

Verfasst: So 14. Okt 2012, 10:43
von PIC18F2550
Singende Servos :lol:

Re: Propeller im Quadrocopter

Verfasst: So 14. Okt 2012, 11:17
von PIC18F2550

Re: Propeller im Quadrocopter

Verfasst: So 30. Jun 2013, 00:53
von PIC18F2550
LP.png
Brushless Motor Controller ohne Spannungsversorgung & Stützkondensatoren.

z.Z denke ich über die Phasenerkennung nach die Variante mit den 3 Comparatoren gefällt mir nicht.

Warscheinlich läuft es darauf hinaus das ich einen schnellen AD-Wandler einsetze und nur eine Phase überwache.

Der Prop hat ja eine schöne Sinushalbwelle in Speicher damit lässt sich bestimmt bestimmen wo sich das Drehfeld befinden muß.