I want to add two pulse generator in simulink and dump it into arduino uno...the result i am getting is change in the frequency at arduino output what i have set in pulse generator?
显示 更早的评论

i want to generate 0.02 (50 hz) time period pulse by adding this two pulse generator, i am getting the output from the arduino but frequncy is not 50 hz, kindly suggest

this is the pulse i want to generate at arduino output for 0.02 time period.
采纳的回答
更多回答(3 个)
Madhu Govindarajan
2019-2-13
1 个投票
Here is what I would recommend -
1) Create a new Simulation only model and put two pulse generators both with a sampling period of 0.02.
2) Adjust the square waves as you see fit and add them up and send it to a scope.
3) Simulate this model and make changes as you see fit.
4) Once you have established you have the square wave of your choice, then bring it back into Arduino model and send it to the digital pin.
5 个评论
Aniket Manjare
2019-2-15
Madhu Govindarajan
2019-2-15
So what do you mean when you can generate it on the DSO? Is it that you are using a signal generator there? or Arduino's digital pin output is measured there and it is correct frequency on the DSO?
What is the frequency you are getting on the Arduino digital pin? How are you measuring this?
Can you share your model?
Aniket Manjare
2019-2-15
Madhu Govindarajan
2019-2-15
Thanks for that response, it is odd that the frequency is 400 Hz. If you can share the new model that would be great, as other users can chime in with their expertise as well.
Aniket Manjare
2019-2-17
Madhu Govindarajan
2019-2-19
0 个投票
Here is what I think is going on - the model is overrunning itself as the sample time for model is small (0.000625 or 1600 Hz). To detect and fix task overruns - https://www.mathworks.com/help/supportpkg/arduino/ug/detect-and-fix-task-overruns-on-arduino-hardware.html
You can also try deploying to hardware, which might avoid overruns sometimes (you are only reducing the scope overhead). Although I doubt it would help at this sampling rate.
3 个评论
Aniket Manjare
2019-2-20
Madhu Govindarajan
2019-2-20
Sure thing.
MITHUN P S
2022-7-5
Sir Iam not able to create high frequency from matlab arduino digital out pin using simulink plss help its urgent...
bella risky ananda
2019-9-16
0 个投票
Hi all...I have problem set PWM frequency for SIMULINK support package of Arduino..I am using MATLAB 2017b and arduino mega2560...for the control i need a PWM signal 25000 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. If you don't mind, can I ask for a soft file of simulink simulation as a reference for my final assignment. I still didn't understand for change pwm frequency arduino in simulink matlab.
Thank you
2 个评论
Arun Kumar
2019-9-25
编辑:Arun Kumar
2019-9-26
Use this Library to change frequency of PWM.
Using this library, you can configure PWM to some extent.
Request for supporting variable PWM frequnecy on arduino is under consideration.
bella risky ananda
2019-9-25
thank you very much for helping and this is very helpful..
类别
在 帮助中心 和 File Exchange 中查找有关 Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

