PWM Frequency for Teensy board stuck at 490.2Hz
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Judicael Aubry
am 14 Apr. 2024
Kommentiert: Judicael Aubry
am 15 Mai 2024
Hello
It seems that the frequency of PWM signals is not configurable for Teensy boards. For all other boards, the achievable frequency is updated according to the desired frequency, but as soon as you choose the Teensy board, the achievable frequency remains stuck at 490.2Hz.
0 Kommentare
Akzeptierte Antwort
Naren
am 6 Mai 2024
Hello Judicael,
For Teensy boards, the PWM frequency can indeed be configured, but it requires a specific approach. Here’s how you can adjust the PWM frequency:
Use the analogWriteFrequency(pin, hz) Function: This function allows you to set the PWM frequency for a specific pin. By calling analogWriteFrequency(pin, desiredFrequency); you can change the frequency to your desired value. This is a straightforward method to adjust the frequency directly.
Note that changing the frequency with analogWriteFrequency() should always be preceded by analogWrite(0) and followed by a new analogWrite(newDutyCycle) to make sure that the duty cycle is recalculated depending on the new PWM frequency.
Regards.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu C2000 Microcontroller Blockset finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!