How to change PWM Frequency of Arduino USING MATLAB SIMULINK Support package

64 ビュー (過去 30 日間)
HARIS
HARIS 2014 年 6 月 11 日
コメント済み: Daniel Velazquez 2021 年 7 月 9 日
Hello,
i have problem with my project. I use Arduino uno and Simulink. For the control i need a PWM signal with 3000 Hz - 5000 Hz but the Simulink support package (PWM) has only 490 Hz and i can change only the duty-cycle.
What can I do?
I would welcome your response
  15 件のコメント
Joseph Humphreys
Joseph Humphreys 2020 年 2 月 26 日
@Ken Noé
Can you use your S-functions for an Arduino Mega 2650? I've tried using it for an Uno and it works but when I switch to the Mega 2650 there is no output from the PWM pin.
Daniel Velazquez
Daniel Velazquez 2021 年 7 月 9 日
You can change the frequency in Simulink just double click on the PWM block in the Frequency drop down menu select: Specify and write your desired frequency in Hz.
The problem is the higher the frequency (>100kHz) the lower the resolution of the PWM, but at 5kHz you should have no problem.
...as of July 8, 2021 with ATMEGA 2560.

サインインしてコメントする。

回答 (1 件)

Greg Wolff
Greg Wolff 2019 年 8 月 15 日
You cannot change the PWM frequency of the PWM block found in the Arduino hardware support package.
You can however create custom device driver blocks. There is a good resource here:
that has various examples, all built around supporting Arduino boards.

コミュニティ

カテゴリ

Help Center および File ExchangeArduino Hardware についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by