Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Serial Communication by MATLAB GUI and how to make Serial Assistant

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how MATLAB GUI realizes serial communication and how to make serial assistant. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Write a serial port assistant using matlab as follows:

At present, I have completed the first version, and I will continue to optimize it later.

Key code:

%% Serial port sending module% check whether the port is online-serial port if isempty (app.sObject) StrArrayNew= {'Serial port not connected'}; logRefresh_func (app,StrArrayNew); returnend% splits the string array of 1x1 into 1xn string array temp=cellstr (app.TextArea_Send.Value); C=strsplit (temp {1}); nn=length (C); decData=zeros (1zhinnn) For ii=1:nn decData (ii) = hex2dec (C (ii)); end% starts sending fwrite (app.sObject, decData,'uint8');% writes data dataSend xx=decMat2binMat_func (app,decData) to obj in binary form; stairs (app.UIAxes,xx,'b-'); app.UIAxes.YLim= [- 1 dint 2];% send complete, log shows StrArrayNew= {'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report