Sending MATLAB simulation data through RS-232 serial communication
4 次查看(过去 30 天)
显示 更早的评论
Hello everyone.
First and foremost I'd like to say that I have little to no experience with this kind of project (hardware interfacing) so when giving any answers I ask of you to do so in a way that would be as easy as possible for someone like me to understand. Thanks and sorry!
I am running a satellite attitude model in MATLAB and everything is running fine. I have a control law that takes attitude inputs and returns the necessary current for the actuators which results in the attitude converging to where I want it to.
The next step in my project is to use an FPGA to take the attitude inputs, perform the necessary computations, and return the necessary current, which is more in line with was is done in the real world.
So what I want is : A new simulation, where in the step in which the required current was computed, I want MATLAB to send the attitude data to the FPGA, where it can be computed by it, then I want the FPGA to send the required current value back into the MATLAB simulation, where it will affect the next instance of attitude data from the simulation. This way I can simulate if the implementation in the FPGA would work in the real life (I'm aware real life is never how we simulated but it would be a good indicator.)
From what I've researched, one way to do this would be through RS232 serial communication. I have already implemented a MATLAB function what will convert the attitude data from decimal to a fixed point signed binary string (Not sure it is useful in this context but it was useful for me to test the implementation of the algorithm in the FPGA). Ideally, I would be able to send that string through the RS232 port but I'm guessing it's not that straight forward. I think I can deal with the FPGA end of this communication but as for the MATLAB part, I don't really know how this can be done.
Since, like I mentioned earlier, I've no experience on this matter I would like to know if any of you has any suggestion on how to send data through R232 to hardware (and back, ideally), while the simulation is running.
Thanks in advance for helping me out! I appreciate it!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Reference Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!