module:arduino:pulsewidthmodulation:stm32f103pwmtest:stm32f103pwmtest
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| module:arduino:pulsewidthmodulation:stm32f103pwmtest:stm32f103pwmtest [2022/04/01 10:55] – [Übersicht] omdevelop | module:arduino:pulsewidthmodulation:stm32f103pwmtest:stm32f103pwmtest [2022/09/13 11:58] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ===== Übersicht ===== | ===== Übersicht ===== | ||
| + | * Klasse CPulseWidthModulator für jeden PWM-Ausgang (und für jeden Controller-Typ) - leider bisher nicht erreicht! | ||
| + | ===== Idee ===== | ||
| + | * PCA9685 16 Channel 12-bit PWM I2C-Servo-Module | ||
| - | ===== Aufgaben ===== | + | ===== Weiterführung ===== |
| - | * Auflösung 16bit bei PWM??? | + | * mit Dispatcher und ControllerRingBus: |
| - | * Wie viele Timer? | + | * ohne Dispatcher, ohne ControllerRingBus: |
| - | * Wie viele Channel für einen Timer? | + | |
| + | ===== Aufgaben | ||
| + | * Auflösung 16bit bei PWM - konnte bisher nicht allgemein beeinflusst werden :-( | ||
| + | * Wie viele Timer? ??? | ||
| + | * Wie viele Channel für einen Timer? | ||
| + | * Grosse Probleme, mit Library oder auch mit PTimer-> | ||
| + | * gegenseitige Beeinflussung, | ||
| ===== ===== | ===== ===== | ||
| - | ===== ===== | + | ===== 220331: Stm32F103PwmTest |
| + | * letzte Entwicklung (anstelle Stm32F103PwmMotorMinimal) | ||
| + | * 2x Servos mit 50Hz (2 Pwms) TIM1 | ||
| + | * 2x Motoren (mit INA und INB, daher 4 Pwms) TIM2 | ||
| + | * letztlich automatische Pwm-Zuordnung über Bibliothek (Standard in Arduino), grausam! | ||
| + | * grausam: nur Funktion setPWM(frequency, | ||
| + | * Version: {{: | ||
| + | * Version: | ||
| + | * Version: {{: | ||
| + | |||
| + | ===== 220331: Stm32F103: Aufbau Timer / Channel ===== | ||
| + | * Version: {{: | ||
| + | * Version: {{: | ||
| + | |||
| + | < | ||
| + | // | ||
| + | // | ||
| + | const int PIN_PWM_A24 = PB11; // ok | ||
| + | const int PIN_PWM_A23 = PB10; // ok | ||
| + | const int PIN_PWM_A34 = PB1; // ok | ||
| + | const int PIN_PWM_A33 = PB0; // ok | ||
| + | const int PIN_PWM_A32 = PA7; // interference PB0/PB1 | ||
| + | const int PIN_PWM_A31 = PA6; // ok | ||
| + | // | ||
| + | const int PIN_PWM_B24 = PA3; // Uart | ||
| + | const int PIN_PWM_B23 = PA2; // Uart | ||
| + | const int PIN_PWM_B22 = PA1; // interference PB10 | ||
| + | // | ||
| + | const int PIN_PWM_C11N = PB13; // interference PB0/PB1 | ||
| + | const int PIN_PWM_C12N = PB14; // interference PB0/PB1 | ||
| + | const int PIN_PWM_C13N = PB15; // interference PB0/PB1 | ||
| + | const int PIN_PWM_C11 = PA8; // interference PB0/PB1 | ||
| + | const int PIN_PWM_C12 = PA9; // interference PB0/PB1 | ||
| + | const int PIN_PWM_C13 = PA10; // interference PB0/PB1 | ||
| + | const int PIN_PWM_C14 = PA11; // interference PB0/PB1 | ||
| + | // | ||
| + | const int PIN_PWM_D21 = PA15; // interference PB0/PB1 | ||
| + | const int PIN_PWM_D22 = PB3; // interference PB0/PB1 | ||
| + | const int PIN_PWM_D23 = PB4; // ok | ||
| + | const int PIN_PWM_D24 = PB5; // ok | ||
| + | // | ||
| + | // Pwm | ||
| + | CPulseWidthModulator ActorA(PIN_PWM_A24); | ||
| + | CPulseWidthModulator ActorB(PIN_PWM_A23); | ||
| + | CPulseWidthModulator ActorC(PIN_PWM_A34); | ||
| + | CPulseWidthModulator ActorD(PIN_PWM_A33); | ||
| + | CPulseWidthModulator ActorE(PIN_PWM_D23); | ||
| + | CPulseWidthModulator ActorF(PIN_PWM_D24); | ||
| + | // | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | for (int I = 0; I < 100; I += 1) | ||
| + | { // Motor | ||
| + | int PwmActorA = min(MAX_PWMA, | ||
| + | int PwmActorB = min(MAX_PWMB, | ||
| + | int PwmActorC = min(MAX_PWMC, | ||
| + | int PwmActorD = min(MAX_PWMD, | ||
| + | int PwmActorE = min(MAX_PWMA, | ||
| + | ActorA.SetFrequencyPwm(FREQUENCY_HIGH, | ||
| + | ActorB.SetFrequencyPwm(FREQUENCY_HIGH, | ||
| + | ActorC.SetFrequencyPwm(FREQUENCY_LOW, | ||
| + | ActorD.SetFrequencyPwm(FREQUENCY_LOW, | ||
| + | ActorE.SetFrequencyPwm(FREQUENCY_HIGH, | ||
| + | // | ||
| + | delay(100); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | * anderer (erfolgloser) Versuch, da nur eine Basisfrequenz für alle PWMs: | ||
| + | < | ||
| + | // 2kHz !!! only ONE PWM-Frequency! | ||
| + | void setup() | ||
| + | { | ||
| + | analogWriteResolution(16); | ||
| + | analogWriteFrequency(2000); | ||
| + | analogWrite(PB11, | ||
| + | analogWrite(PB10, | ||
| + | analogWrite(PB0, | ||
| + | analogWrite(PB1, | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== 220330: Stm32F103: Aufbau Timer / Channel | ||
module/arduino/pulsewidthmodulation/stm32f103pwmtest/stm32f103pwmtest.1648803338.txt.gz · Last modified: 2022/04/01 10:55 by omdevelop