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 17:07] – [220331: Stm32F103: Aufbau Timer / Channel] 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 ===== | ===== 220331: Stm32F103: Aufbau Timer / Channel ===== | ||
| * Version: {{: | * Version: {{: | ||
| Line 52: | Line 71: | ||
| < | < | ||
| - | | + | for (int I = 0; I < 100; I += 1) |
| - | { // Motor | + | { // Motor |
| - | int PwmActorA = min(MAX_PWMA, | + | int PwmActorA = min(MAX_PWMA, |
| - | int PwmActorB = min(MAX_PWMB, | + | int PwmActorB = min(MAX_PWMB, |
| - | int PwmActorC = min(MAX_PWMC, | + | int PwmActorC = min(MAX_PWMC, |
| - | int PwmActorD = min(MAX_PWMD, | + | int PwmActorD = min(MAX_PWMD, |
| - | int PwmActorE = min(MAX_PWMA, | + | int PwmActorE = min(MAX_PWMA, |
| - | ActorA.SetFrequencyPwm(FREQUENCY_HIGH, | + | ActorA.SetFrequencyPwm(FREQUENCY_HIGH, |
| - | ActorB.SetFrequencyPwm(FREQUENCY_HIGH, | + | ActorB.SetFrequencyPwm(FREQUENCY_HIGH, |
| - | ActorC.SetFrequencyPwm(FREQUENCY_LOW, | + | ActorC.SetFrequencyPwm(FREQUENCY_LOW, |
| - | ActorD.SetFrequencyPwm(FREQUENCY_LOW, | + | ActorD.SetFrequencyPwm(FREQUENCY_LOW, |
| - | ActorE.SetFrequencyPwm(FREQUENCY_HIGH, | + | ActorE.SetFrequencyPwm(FREQUENCY_HIGH, |
| - | // | + | // |
| - | delay(100); | + | delay(100); |
| - | } | + | } |
| + | </ | ||
| + | |||
| + | | ||
| + | < | ||
| + | // 2kHz !!! only ONE PWM-Frequency! | ||
| + | void setup() | ||
| + | { | ||
| + | analogWriteResolution(16); | ||
| + | analogWriteFrequency(2000); | ||
| + | analogWrite(PB11, | ||
| + | analogWrite(PB10, | ||
| + | analogWrite(PB0, | ||
| + | analogWrite(PB1, | ||
| + | } | ||
| </ | </ | ||
module/arduino/pulsewidthmodulation/stm32f103pwmtest/stm32f103pwmtest.1648825642.txt.gz · Last modified: 2022/04/01 17:07 by omdevelop