For different simulation instants Simulink shows different values read from the serial port for the same input on the ADC pin.
2 views (last 30 days)
Show older comments
Prashant Mishra on 2 Dec 2022
Answered: Mark McBroom on 2 Jan 2023
Hello Matlab Community!
I have been trying to use Simulink to read the voltage sensor data output through the ADC pin on the Microcontroller board. However, there are a lot of issues I fail to address. If anyone has any idea on how to resolve these problems, please guide me through.
1. Starting simulation at different times gives different values without changing any thing in the setup. As you can see in the attached video(Click Here), I have to stop and start simulation file multiple times before I get the right data from the port. I want the program to perform exactly the same way all the time if there is no change in hardware/program setup. How do I ensure this using simulink?
2. The noise on the ADC is very high. I need to extract the DC value from the signal shown in the scope. I have tried using IIR filter, Moving average as well as Running Mean. But none of them give the proper value. There is always +-2V error in the values read.
I look forward to your help and guidance.
Mark McBroom on 2 Jan 2023
When you push the simulation button for the model on the left ( untitled1 ), the model is not running on the actual hardware. You need to push the "Run on Hardware" button on the "hardware" tab for the Simulink model to actually run on the microcontroller board and read the A/D.
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!