How GUI communicates with microcontroller?
4 次查看(过去 30 天)
显示 更早的评论
Hi, I have to do my first GUI to control a micro controller (freescale kl25z). I red the document to create a GUI by using the GUIDE, but I don't know how to send data from/to micro controller to matlab and vice versa. Where I have to write the function, if on MatLab or on the micro controller ( if I want to toggle a led for example, the code to toggle must be on matlab or on the micro controller code?), have you some easy example on gui for kl25z board? I don't know how to start. Thank you very much.
0 个评论
回答(1 个)
MathWorks Student Competitions Team
2015-11-4
Currently, The Freescale FRDM-KL25Z Board is supported by MathWorks through an Embedded Coder Support Package. This support package allows users to create algorithms using Simulink that can control peripherals on the FRDM-KL25Z (like the rgb LED). Then, with a single click, C code can be generated from those algorithms, compiled and loaded onto the board to affect the actual hardware.
The simplest way to affect the hardware (for example, toggle an LED), using this support package, is with something called External Mode, which allows you to adjust the values in your algorithm in your Simulink model, and have those values automatically update on the board, without having to recompile or reload the algorithm.
There are currently no examples showing how to use MATLAB to change values on the FRDM-KL25Z board, since this board is primarily supported for use with Simulink. It is possible to control Simulink from the MATLAB Command Window, however, so it would be possible to load a Simulink model setup for External Mode, and then use MATLAB to change parameters in the Simulink model, which would change the values on the hardware.
There are other pieces of hardware that has support in base MATLAB, meaning that MATLAB can be used to read values from the board and write data to the board directly (Arduino, Raspberry Pi, BeagleBone Black, etc. ). For these pieces of hardware, the code to toggle the LED would exist in MATLAB (specifically in your GUI).
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!