How to set Arduino TCCR1A and TCCR1B PWM-parameters in MATLAB?

14 ビュー (過去 30 日間)
Sergiy Sheyko
Sergiy Sheyko 2019 年 1 月 27 日
編集済み: hongjie cui 2019 年 4 月 28 日
Hello World,
It's needed to change Pulse-width modulation frequency on Arduino Board by Matlab, but could not find the way to do so.
In arduino coder it's perfectly realized by:
void setup()
{ TCCR1A = TCCR1A & 0xe0 | 1;
TCCR1B = TCCR1B & 0xe0 | 0x09;
}
but in MatLab?

採用された回答

Sergiy Sheyko
Sergiy Sheyko 2019 年 1 月 27 日
In the Matlab Arduino package there is the file:
c:\ProgramData\MATLAB\SupportPackages\R2017a\toolbox\matlab\hardware\supportpackages\arduinoio\src\ArduinoServer.ino
Modify it setup() function:
void setup()
{ MWArduino.begin([connection_type]);
TCCR1A = TCCR1A & 0xe0 | 1;
TCCR1B = TCCR1B & 0xe0 | 0x09;
}
  1 件のコメント
hongjie cui
hongjie cui 2019 年 4 月 28 日
編集済み: hongjie cui 2019 年 4 月 28 日
hi,i want to change arduino pwm frequency using simulink Arduino package,i used arduino pwm block in simulink,but it can not change pwm frequency.i set Arduino TCCR1A and TCCR1B PWM-parameters following your answer, it works in matlab,but it does not work in simulink.
so,i want to know how to change arduino pwm frequency using simulink?thank you for your reply!
if you have any ideas,please reply me or email to me:1945235463@qq.com.thank you very much!

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

その他の回答 (0 件)

コミュニティ

カテゴリ

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

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by