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?
24 views (last 30 days)
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.
More Answers (3)
Madhu Govindarajan on 13 Feb 2019
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.
Madhu Govindarajan on 19 Feb 2019
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.
bella risky ananda on 16 Sep 2019
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.