This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| de:software:homelab:library:module:motor [2010/10/29 13:12] – Wember | de:software:homelab:library:module:motor [2020/07/20 12:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Motoren ====== | ====== Motoren ====== | ||
| - | //Related to: [HW] [[en: | + | //Bezug nehmend auf: [HW] [[en: |
| - | Diese Bibliothek enthält Funktionen | + | Diese Bibliothek enthält Funktionen |
| ===== Funktionen ===== | ===== Funktionen ===== | ||
| * **//void dcmotor_init(unsigned char index)//** \\ | * **//void dcmotor_init(unsigned char index)//** \\ | ||
| - | | + | |
| - | * //index// - Index of motor controller. 0 to 3. | + | * //index// - Index des Motorencontrollers. 0 bis 3. |
| * **//void dcmotor_drive(unsigned char index, signed char direction)// | * **//void dcmotor_drive(unsigned char index, signed char direction)// | ||
| - | | + | |
| - | * //index// - Index of motor controller. 0 to 3. | + | * //index// - Index des Motorencontrollers. 0 bis 3. |
| - | * // | + | * // |
| * **//void unipolar_init(unsigned char index)//** \\ | * **//void unipolar_init(unsigned char index)//** \\ | ||
| - | | + | |
| - | * //index// - Index of motor controller. 0 or 1. | + | * //index// - Index des Motorencontrollers. 0 oder 1. |
| * **//void unipolar_halfstep(unsigned char index, signed char direction, unsigned short num_steps, unsigned char speed)//** \\ | * **//void unipolar_halfstep(unsigned char index, signed char direction, unsigned short num_steps, unsigned char speed)//** \\ | ||
| - | | + | |
| - | * //index// - Index of motor controller. 0 or 1. | + | * //index// - Index des Motorencontrollers. 0 oder 1. |
| - | * // | + | * // |
| - | * // | + | * // |
| - | * //speed// - Time of a single step in milliseconds. | + | * //speed// - Zeit eines einzelnen Schritts |
| * **//void bipolar_init(void)// | * **//void bipolar_init(void)// | ||
| - | | + | |
| + | |||
| * **//void bipolar_halfstep(signed char direction, unsigned short num_steps, unsigned char speed)//** \\ | * **//void bipolar_halfstep(signed char direction, unsigned short num_steps, unsigned char speed)//** \\ | ||
| - | | + | |
| - | * // | + | * // |
| - | * // | + | * // |
| - | * //speed// - Time of a single step in milliseconds. | + | * //speed// - Zeit eines einzelnen Schritts |
| * **//void servomotor_init(unsigned char index)//** \\ | * **//void servomotor_init(unsigned char index)//** \\ | ||
| - | | + | |
| - | * //index// - Index of servo motor. 0 or 1. | + | * //index// - Index des Servomotors. 0 oder 1. |
| * **//void servomotor_position(unsigned char index, signed short position)// | * **//void servomotor_position(unsigned char index, signed short position)// | ||
| - | | + | |
| - | * //index// - Index of servo motor. 0 or 1. | + | * //index// - Index des Servomotors. 0 oder 1. |
| - | * // | + | * // |
| ===== Beispiel ===== | ===== Beispiel ===== | ||
| - | Das folgende Programm veranschaulicht das Nutzen | + | Nutzung |
| <code c> | <code c> | ||
| Line 54: | Line 54: | ||
| int main(void) | int main(void) | ||
| { | { | ||
| - | // DC motors initialization. | + | // Initialisierung der DC Motoren. |
| dcmotor_init(0); | dcmotor_init(0); | ||
| dcmotor_init(1); | dcmotor_init(1); | ||
| - | // Bipolar stepper initialization. | + | // Initialisierung des bipolaren Schrittmotors. |
| bipolar_init(); | bipolar_init(); | ||
| - | // Servo motors initialization. | + | // Initialisierung der Servomotoren. |
| servomotor_init(0); | servomotor_init(0); | ||
| servomotor_init(1); | servomotor_init(1); | ||
| - | // One DC motors drives forward, another in backward direction. | + | // Ein DC Motor fährt vorwärts, ein anderer rückwärts. |
| dcmotor_drive(0, | dcmotor_drive(0, | ||
| dcmotor_drive(1, | dcmotor_drive(1, | ||
| - | // Rotating the stepper motor 100 steps in one direction | + | // Bewegt den Schrittmotor |
| - | // and then back with twice the speed. | + | // und daraufhin zurück mit doppelter Geschwindigkeit. |
| bipolar_halfstep(1, | bipolar_halfstep(1, | ||
| bipolar_halfstep(-1, | bipolar_halfstep(-1, | ||
| - | // Rotating servo motors | + | // Bewegt Servomotoren |
| servomotor_position(0, | servomotor_position(0, | ||
| servomotor_position(1, | servomotor_position(1, | ||
| } | } | ||
| </ | </ | ||