找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2415|回复: 1
打印 上一主题 下一主题
收起左侧

DSP28335驱动Lcd12864显示Ds18b20采集到的温度,并通过Sci传输至PC,使用Matlab制作...

[复制链接]
跳转到指定楼层
楼主
ID:462570 发表于 2019-7-5 10:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
这是一个DSP28335驱动Lcd12864显示Ds18b20采集到的温度,并通过Sci方式传输至PC,使用Matlab制作上位机软件进行数据保存与显示的文章。
首先主要是为了弥补 CCS无法实时捕捉数据至上位机的缺陷(可能CCS有,但是我却没找到,如果有读者知道具体答案,请留言告诉我。)。当然串口传输来的数据也有不足的地方,就是这些数据只能让我们感性的观看,如果想做数据分析,如FFT等,可能数据的采样精度就不够了。所以这也是一个不足的地方,希望日后能有解决的办法。下面开始正文部分吧!
废话不多说,先来张效果图:
图1是DSP_demo板加Lcd12864的显示。显示的比较粗糙,026.56就是26.56℃,一些细节没有做好,主要是功能的实现。
图2是使用Matlab2017b的AppDesigner制作的串口通信上位机软件,具体功能有:发送(TX)、接收(RX)、实时绘图、数据实时保存等。其中COM口和波特率需要设置,其他的如:数据位、校验位、停止位等等,已经在代码中默认设置了,因为只是这个小设计的定制版本,也没有高兴将所有功能都全部放置在界面上。
图像中,出现了34℃,那是我用手拿住了 Ds18b20。目前是6月底,江苏黄梅天,今天室温就是27℃左右。
图3是采集到的数据。只是展示了部分,刚开机的时候是没有打开文本存储按钮的,因此第一个数据与图2中接收数据框中前几个数据不是对应的。​​​                                                      
效果展示完了,那么接下来就是代码部分:
  1. /*
  2. * 功能:1.DS18B20进行温度采集,并使用12864进行显示
  3. *                 2.将采集到的温度 通过SCIA传输,因为SCIB的9口被12864占用,所以不能用SCIB
  4. *                 3.SCIA使用CpuTimer0中断,1s传输一次温度数据给PC,未使用FIFO中断
  5. * 波特率:9600  8位数据位,1位停止位,无校验位
  6. */

  7. #include "DSP2833x_Project.h"
  8. #include "math.h"

  9. #include "lcd12864.h"
  10. #include "ds18b20_para.h"

  11. #define uchar  unsigned char

  12. void init_port(void);
  13. uchar Init_DS18B20();
  14. uchar ReadOneChar(void);
  15. void WriteOneChar(uchar dat);
  16. float ReadTemperature();
  17. void lcd_init(void);
  18. void lcd_write_cmd(uchar cmd);                        
  19. void lcd_write_dat(uchar dat);                        
  20. void LCD12864SetAddress_f( uchar x, uchar y );          //地址转换
  21. void show(uchar x, uchar y, uchar * data);        

  22. void scia_init(void);
  23. void GPIO_init();
  24. interrupt void Timer0_ISR(void);

  25. uchar table[7];

  26. int main(void)
  27. {

  28.         float tt;
  29.         int tt1;

  30.         InitSysCtrl();

  31.         init_port();   //ds18b20 & 12864 端口初始化

  32.         DINT;
  33.         InitPieCtrl();        //初始化中断控制
  34.         IER = 0x0000;
  35.         IFR = 0x0000;
  36.         InitPieVectTable();//初始化中断矢量表

  37.         GPIO_init();  //配置端口为SCI

  38.         EALLOW;        // This is needed to write to EALLOW protected registers
  39.         PieVectTable.TINT0 = &Timer0_ISR;//将定时器0中断服务函数入口放入中断向量表
  40.         EDIS;   // This is needed to disable write to EALLOW protected registers

  41.         InitCpuTimers();
  42.         ConfigCpuTimer(&CpuTimer0, 150, 1000000);        //定时器0定时时间为 1s

  43.         scia_init();        //SCIA端口初始化

  44.         lcd_init();

  45.         PieCtrlRegs.PIECTRL.bit.ENPIE = 1;   // Enable the PIE block
  46.         PieCtrlRegs.PIEIER1.bit.INTx7=1;     // PIE Group 1, INT7
  47.         IER = 0x001;
  48.         EINT;


  49.         CpuTimer0Regs.TCR.bit.TSS = 0;  // 启动定时器0

  50.         while (1)
  51.         {
  52.                 tt=ReadTemperature();
  53.                 tt1=tt*100+0.5;
  54.                 //留两个小数点就*100,+0.5是四舍五入,因为C语言浮点数转换为整型的时候把小数点
  55.                 //后面的数自动去掉,不管是否大于0.5,而+0.5之后大于0.5的就是进1了,小于0.5的就
  56.                 //算加上0.5,还是在小数点后面。

  57.                 table[0]=tt1/10000+0x30;  //百位
  58.                 table[1]=tt1%10000/1000+0x30;//十位
  59.                 table[2]=tt1%1000/100+0x30;//个位
  60.                 table[3]='.';
  61.                 table[4]=tt1%100/10+0x30;//十分位;
  62.                 table[5]=tt1%10+0x30;//百分位;
  63.                 table[6]='\0';  //用来中止一组显示数据
  64.                 show(0,0,table);
  65.         }

  66. }

  67. //----------------------
  68. //--- 12864 及  DS18B20 的初始化
  69. //----------------------
  70. void init_port(void)
  71. {
  72.         EALLOW;
  73.                 GpioCtrlRegs.GPBPUD.bit.GPIO40 = 0;    // 使能GPIO10 引脚内部上拉

  74.                 GpioCtrlRegs.GPBMUX1.bit.GPIO40 =0;   // 配置GPIO10为通用I/O口

  75.                 GpioCtrlRegs.GPBQSEL1.bit.GPIO40 = 0;    // GPIO40与系统时钟SYSCLKOUT 同步

  76.                 //lcd12864 use
  77.                 GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0;    // 使能GPIO0 引脚内部上拉

  78.                 GpioCtrlRegs.GPAPUD.bit.GPIO1 = 1;   // 禁止GPIO1 引脚内部上拉
  79.                 GpioCtrlRegs.GPAQSEL1.all = 0x0000;    // GPIO0-GPIO15与系统时钟SYSCLKOUT 同步

  80.                 GpioCtrlRegs.GPADIR.all = 0x003FF;// 配置GPIO0-GPIO9为输出引脚

  81.                 //输出数据LCD_RW和LCD_EN清零
  82.                 GpioDataRegs.GPADAT.bit.GPIO0 = 1;
  83.                 GpioDataRegs.GPADAT.bit.GPIO1 = 0;
  84.     EDIS;
  85. }

  86. //----------------------
  87. //---SCI的初始化
  88. //----------------------
  89. void GPIO_init()
  90. {
  91.         EALLOW;
  92.         GpioCtrlRegs.GPBPUD.bit.GPIO35 = 0;     // Enable pull-up for GPIO35  (SCITXDA)
  93.         GpioCtrlRegs.GPBMUX1.bit.GPIO35 = 1;    // GPIO35 for SCITXDA operation

  94.         GpioCtrlRegs.GPBPUD.bit.GPIO36 = 0;    // Enable pull-up for GPIO36 (SCIRXDA)
  95.         GpioCtrlRegs.GPBQSEL1.bit.GPIO36 = 3;  // Asynch input GPIO36 (SCIRXDA)
  96.         GpioCtrlRegs.GPBMUX1.bit.GPIO36 = 1;   // GPIO36 for SCIRXDA operation

  97.         EDIS;
  98. }



  99. void scia_init(void)
  100. {
  101.         SciaRegs.SCICCR.all =0x0007;    // 1 stop bit,
  102.                                                                       // No parity,8 char bits,
  103.                                                                       // async mode, idle-line protocol
  104.         SciaRegs.SCICTL1.all =0x0003;   // enable TX, RX, internal SCICLK,
  105.                                                                       // Disable RX ERR, SLEEP, TXWAKE

  106.         SciaRegs.SCIHBAUD    =0x0001;
  107.         SciaRegs.SCILBAUD    =0x00E7;   //构成 0x01e7=487 波特率计算为   37.5M/[(487+1)*8]=9605 近似等于9600

  108.         SciaRegs.SCICTL1.bit.SWRESET=1;//Relinquish SCI from Reset

  109. }

  110. interrupt void Timer0_ISR(void)
  111. {
  112.         int i=0;

  113.     while(table[i] != '\0')                        //不断发送,直到1组温度数据发送完毕
  114.     {
  115.             SciaRegs.SCITXBUF=table[i];  //发送数据
  116.             DELAY_US(1000);                                //若不加,会出现数据丢失
  117.             i++;
  118.     }

  119.     SciaRegs.SCITXBUF='\n';                        //每接收一组数据后,换行

  120.            PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;//PIE组1应答
  121. }
复制代码

以上是DSP上的代码。接下来是上位机代码,供大家学习。这其中的一部分代码,我也是从网上寻找来的,因此在此要感谢那位哥们开放的串口软件。Appdesigner比较新,界面也不错,如果大家喜欢,可以自己做出修改,但是我希望大家在我这个版本基础上修改后,能在留言处开源自己的内容,让大家一起进步。首先将app的链接给出:

链接:https://pan.baidu.com/s/1NEqKQJX87mv86V9ENZ2kkA
提取码:x3y0

或  https://download.csdn.net/download/wx_simba/11259531





以下是代码,有Matlab的朋友可以直接用 Appdesigner打开查看。注意,至少需要 2016a版本才具有Appdesigner功能。

***这是回头打的字,插入代码居然没有Matlab的m语言格式。。。还有下面代码看着多,其实估计80%都是系统生成的,我们是无法修改的,实现功能的代码其实不多


  1. classdef app2 < matlab.apps.AppBase

  2.     % Properties that correspond to app components
  3.     properties (Access = public)
  4.         UIFigure             matlab.ui.Figure
  5.         pbOpenSerial         matlab.ui.control.StateButton
  6.         RXLabel              matlab.ui.control.Label
  7.         TXLabel              matlab.ui.control.Label
  8.         Label_RX             matlab.ui.control.Label
  9.         Label_TX             matlab.ui.control.Label
  10.         ReceiveView          matlab.ui.control.TextArea
  11.         Button_Send          matlab.ui.control.Button
  12.         transmitView         matlab.ui.control.TextArea
  13.         Button_Clear         matlab.ui.control.Button
  14.         DropDownLabel        matlab.ui.control.Label
  15.         ppCOM                matlab.ui.control.DropDown
  16.         Label                matlab.ui.control.Label
  17.         Label_2              matlab.ui.control.Label
  18.         Lamp                 matlab.ui.control.Lamp
  19.         Label_3              matlab.ui.control.Label
  20.         ppCOM_2              matlab.ui.control.DropDown
  21.         Panel                matlab.ui.container.Panel
  22.         Label_5              matlab.ui.control.Label
  23.         txtStoreSwich        matlab.ui.control.Switch
  24.         Label_6              matlab.ui.control.Label
  25.         txtStoreFlag         matlab.ui.control.Lamp
  26.         UIAxes               matlab.ui.control.UIAxes
  27.         UartsEditFieldLabel  matlab.ui.control.Label
  28.         UartsEditField       matlab.ui.control.NumericEditField
  29.     end

  30.    
  31.     properties (Access = public)
  32.         COM;    % 端口号
  33.         Baud_Rate; %波特率
  34.         s  ;    %端口设置句柄
  35.         RX_num; %接收统计
  36.         TX_num; %发送统计
  37.         RX_once;%一次接收的数据
  38.         RX_Date;%接收的所有数据
  39.         is_open;%是否打开串口标志位
  40.         Flag_i %绘图横坐标的点
  41.         
  42.     end
  43.    
  44.    
  45.    
  46.     methods (Access = public)
  47.         function  EveBytesAvailableFcn(app, src, event)
  48.             n = src.BytesAvailable;%获取接收到的字符个数
  49.             if n>0%n>0才继续执行,因为0也会触发中断
  50.                 app.RX_num=app.RX_num+n;
  51.                 app.Label_RX.Text=num2str(app.RX_num);%将数字转化为字符串输出
  52.                 app.RX_once=fread(src,n,'uchar');%读取函数,读取后矩阵为一列
  53.                 app.RX_Date =strcat(app.RX_Date, app.RX_once');%字符串拼接,需要转置化为一行
  54.                 app.ReceiveView.Value= app.RX_Date;%textarea的设置格式为cell,或单行字符串
  55.                 app.Flag_i=app.Flag_i+1;
  56.                 t=app.Flag_i*app.UartsEditField.Value;
  57.                 y=str2double(char(app.RX_once'));   
  58.                 plot(app.UIAxes,t,y,'marker','+','linewidth',5,'linestyle','--');
  59.                 hold(app.UIAxes,'on');
  60.                
  61.                 if strcmp(app.txtStoreSwich.Value,'On')
  62.                     app.txtStoreFlag.Color=[0 1 0];
  63.                     name_ref=['wx',datestr(now,29),'.txt']; % name_ref=['wx',datestr(now,29),'.xls'];
  64.                     fid = fopen(name_ref,'a'); %fid = fopen('c.xls','a');
  65.                     fprintf(fid,'%s\r\n',app.RX_once');  %需要转置,进行换行处理,txt换行 要\r\n..xls只\n就可以换行
  66.                     fclose(fid);
  67.                 else
  68.                     app.txtStoreFlag.Color=[0 0 0];
  69.                 end
  70.             end
  71.         end
  72.         
  73.     end
  74.    
  75.    
  76.     methods (Access = private)
  77.         % Code that executes after component creation
  78.         function startupFcn(app)
  79.             app.RX_num=0;
  80.             app.TX_num=0;
  81.             app.is_open=0;
  82.             app.Flag_i=0;
  83.             scoms = instrfind;%获取占用的串口号
  84.             if scoms ~= 0%如果存在则关闭,否则不能打开
  85.                 stopasync(scoms);
  86.                 fclose(scoms);
  87.                 delete(scoms);
  88.             end
  89.             
  90.             
  91.         end
  92.         % Button pushed function: Button_Send
  93.         function Button_SendPushed(app, event)
  94.             val=app.transmitView.Value;
  95.             if length(val{1})>0%textarea控件是cell格式,获取需要用{1}
  96.                 app.TX_num=app.TX_num+length(val{1});
  97.                 app.Label_TX.Text=num2str(app.TX_num);
  98.                 fwrite(app.s, char(val), 'uint8', 'async');%需要将val转化为char
  99.             end
  100.         end
  101.         % Value changed function: pbOpenSerial
  102.         function pbOpenSerialValueChanged2(app, event)
  103.             
  104.             app.COM=get(app.ppCOM,'Value');
  105.             app.Baud_Rate=get(app.ppCOM_2,'Value');
  106.             if strcmp(get(app.pbOpenSerial,'Text'),'打开串口')
  107.                 try
  108.                     app.s=serial(app.COM);
  109.                     app.s.BaudRate=str2double(app.Baud_Rate);%设置波特率,str2double 很重要
  110.                     app.s.DataBits=8;%设置数据长度
  111.                     app.s.StopBits=1;%设置停止位长度
  112.                     app.s.InputBufferSize=1024000;%设置输入缓冲区大小为1M
  113.                     app.s.BytesAvailableFcnMode='byte';  %串口事件回调设置
  114.                     %  app.s.Terminator='CR/LF';
  115.                     app.s.BytesAvailableFcnCount=1; %输入缓冲区存在10个字节触发回调函数
  116.                     app.s.BytesAvailableFcn={@app.EveBytesAvailableFcn};%回调函数的指定
  117.                     
  118.                     fopen(app.s);%打开串口
  119.                     app.is_open=1;
  120.                     app.pbOpenSerial.Text='关闭串口';
  121.                     app.Lamp.Color=[0 1 0];
  122.                 catch err
  123.                     msgbox('打开失败');
  124.                 end
  125.             else
  126.                 try
  127.                     fclose(app.s);
  128.                     app.pbOpenSerial.Text='打开串口';
  129.                     app.Lamp.Color=[0.15 0.15 0.15];
  130.                 catch err
  131.                     msgbox('关闭失败');
  132.                 end
  133.                 delete(app.s);
  134.                 app.is_open=0;
  135.             end
  136.         end
  137.         % Close request function: UIFigure
  138.         function UIFigureCloseRequest(app, event)
  139.             delete(app)
  140.             
  141.         end
  142.         % Button pushed function: Button_Clear
  143.         function Button_ClearPushed(app, event)
  144.             app.RX_Date ='';
  145.             app.ReceiveView.Value= app.RX_Date;
  146.             app.TX_num=0;
  147.             app.RX_num=0;
  148.             app.Label_TX.Text=num2str(app.TX_num);
  149.             app.Label_RX.Text=num2str(app.RX_num);
  150.             cla(app.UIAxes,'reset');
  151.         end
  152.         % Value changed function: txtStoreSwich
  153.         function txtStoreSwichValueChanged(app, event)
  154.             value = app.txtStoreSwich.Value;
  155.             if strcmp(value,'On')
  156.                 app.txtStoreFlag.Color=[0 1 0];
  157.             else
  158.                 app.txtStoreFlag.Color=[0 0 0];
  159.             end
  160.         end
  161.     end
  162.     % App initialization and construction
  163.     methods (Access = private)
  164.         % Create UIFigure and components
  165.         function createComponents(app)
  166.             % Create UIFigure
  167.             app.UIFigure = uifigure;
  168.             app.UIFigure.Position = [500 300 895 521];
  169.             app.UIFigure.Name = 'UI Figure';
  170.             app.UIFigure.CloseRequestFcn = createCallbackFcn(app, @UIFigureCloseRequest, true);
  171.             % Create pbOpenSerial
  172.             app.pbOpenSerial = uibutton(app.UIFigure, 'state');
  173.             app.pbOpenSerial.ValueChangedFcn = createCallbackFcn(app, @pbOpenSerialValueChanged2, true);
  174.             app.pbOpenSerial.Text = '打开串口';
  175.             app.pbOpenSerial.FontSize = 16;
  176.             app.pbOpenSerial.FontWeight = 'bold';
  177.             app.pbOpenSerial.Position = [740 311 81 27];
  178.             % Create RXLabel
  179.             app.RXLabel = uilabel(app.UIFigure);
  180.             app.RXLabel.Position = [42 60 25 15];
  181.             app.RXLabel.Text = 'RX:';
  182.             % Create TXLabel
  183.             app.TXLabel = uilabel(app.UIFigure);
  184.             app.TXLabel.Position = [102 60 25 15];
  185.             app.TXLabel.Text = 'TX:';
  186.             % Create Label_RX
  187.             app.Label_RX = uilabel(app.UIFigure);
  188.             app.Label_RX.Position = [66 60 37 15];
  189.             app.Label_RX.Text = '0';
  190.             % Create Label_TX
  191.             app.Label_TX = uilabel(app.UIFigure);
  192.             app.Label_TX.Position = [126 60 82 15];
  193.             app.Label_TX.Text = '0';
  194.             % Create ReceiveView
  195.             app.ReceiveView = uitextarea(app.UIFigure);
  196.             app.ReceiveView.Position = [25 192 161 270];
  197.             % Create Button_Send
  198.             app.Button_Send = uibutton(app.UIFigure, 'push');
  199.             app.Button_Send.ButtonPushedFcn = createCallbackFcn(app, @Button_SendPushed, true);
  200.             app.Button_Send.FontSize = 16;
  201.             app.Button_Send.FontWeight = 'bold';
  202.             app.Button_Send.Position = [716 96 100 27];
  203.             app.Button_Send.Text = '发送';
  204.             % Create transmitView
  205.             app.transmitView = uitextarea(app.UIFigure);
  206.             app.transmitView.Position = [27 88 159 60];
  207.             % Create Button_Clear
  208.             app.Button_Clear = uibutton(app.UIFigure, 'push');
  209.             app.Button_Clear.ButtonPushedFcn = createCallbackFcn(app, @Button_ClearPushed, true);
  210.             app.Button_Clear.FontSize = 16;
  211.             app.Button_Clear.FontWeight = 'bold';
  212.             app.Button_Clear.Position = [716 49 100 27];
  213.             app.Button_Clear.Text = '清空';
  214.             % Create DropDownLabel
  215.             app.DropDownLabel = uilabel(app.UIFigure);
  216.             app.DropDownLabel.HorizontalAlignment = 'right';
  217.             app.DropDownLabel.FontName = 'Calibri';
  218.             app.DropDownLabel.FontSize = 18;
  219.             app.DropDownLabel.Position = [684 422 41 24];
  220.             app.DropDownLabel.Text = '串口';
  221.             % Create ppCOM
  222.             app.ppCOM = uidropdown(app.UIFigure);
  223.             app.ppCOM.Items = {'COM1', 'COM2', 'COM3', 'COM4'};
  224.             app.ppCOM.FontName = 'Calibri';
  225.             app.ppCOM.FontSize = 18;
  226.             app.ppCOM.Position = [740 424 76 25];
  227.             app.ppCOM.Value = 'COM1';
  228.             % Create Label
  229.             app.Label = uilabel(app.UIFigure);
  230.             app.Label.FontSize = 18;
  231.             app.Label.FontWeight = 'bold';
  232.             app.Label.Position = [39 475 42 23];
  233.             app.Label.Text = '接收';
  234.             % Create Label_2
  235.             app.Label_2 = uilabel(app.UIFigure);
  236.             app.Label_2.FontSize = 18;
  237.             app.Label_2.FontWeight = 'bold';
  238.             app.Label_2.Position = [39 151 42 23];
  239.             app.Label_2.Text = '发送';
  240.             % Create Lamp
  241.             app.Lamp = uilamp(app.UIFigure);
  242.             app.Lamp.Position = [695 317 20 20];
  243.             app.Lamp.Color = [0.149 0.149 0.149];
  244.             % Create Label_3
  245.             app.Label_3 = uilabel(app.UIFigure);
  246.             app.Label_3.HorizontalAlignment = 'right';
  247.             app.Label_3.FontName = 'Calibri';
  248.             app.Label_3.FontSize = 18;
  249.             app.Label_3.Position = [682 373 59 24];
  250.             app.Label_3.Text = '波特率';
  251.             % Create ppCOM_2
  252.             app.ppCOM_2 = uidropdown(app.UIFigure);
  253.             app.ppCOM_2.Items = {'300', '600', '1200', '2400', '4800', '9600', '19200', '38400', '115200'};
  254.             app.ppCOM_2.FontName = 'Calibri';
  255.             app.ppCOM_2.FontSize = 18;
  256.             app.ppCOM_2.Position = [756 375 60 25];
  257.             app.ppCOM_2.Value = '9600';
  258.             % Create Panel
  259.             app.Panel = uipanel(app.UIFigure);
  260.             app.Panel.Position = [655 173 231 87];
  261.             % Create Label_5
  262.             app.Label_5 = uilabel(app.Panel);
  263.             app.Label_5.HorizontalAlignment = 'center';
  264.             app.Label_5.Position = [136 24 77 15];
  265.             app.Label_5.Text = '文本存储按钮';
  266.             % Create txtStoreSwich
  267.             app.txtStoreSwich = uiswitch(app.Panel, 'slider');
  268.             app.txtStoreSwich.ValueChangedFcn = createCallbackFcn(app, @txtStoreSwichValueChanged, true);
  269.             app.txtStoreSwich.Position = [151 54 45 20];
  270.             % Create Label_6
  271.             app.Label_6 = uilabel(app.Panel);
  272.             app.Label_6.HorizontalAlignment = 'right';
  273.             app.Label_6.Position = [26 24 77 15];
  274.             app.Label_6.Text = '文本存储指示';
  275.             % Create txtStoreFlag
  276.             app.txtStoreFlag = uilamp(app.Panel);
  277.             app.txtStoreFlag.Position = [52 45 29 29];
  278.             app.txtStoreFlag.Color = [0 0 0];
  279.             % Create UIAxes
  280.             app.UIAxes = uiaxes(app.UIFigure);
  281.             title(app.UIAxes, 'Figure')
  282.             xlabel(app.UIAxes, 'time')
  283.             ylabel(app.UIAxes, 'Y')
  284.             app.UIAxes.LineStyleOrder = {'- '};
  285.             app.UIAxes.NextPlot = 'add';
  286.             app.UIAxes.Position = [197 46 445 438];
  287.             % Create UartsEditFieldLabel
  288.             app.UartsEditFieldLabel = uilabel(app.UIFigure);
  289.             app.UartsEditFieldLabel.HorizontalAlignment = 'right';
  290.             app.UartsEditFieldLabel.Position = [262 18 121 15];
  291.             app.UartsEditFieldLabel.Text = 'Uart发送数据的周期/s';
  292.             % Create UartsEditField
  293.             app.UartsEditField = uieditfield(app.UIFigure, 'numeric');
  294.             app.UartsEditField.Limits = [0 Inf];
  295.             app.UartsEditField.Position = [398 14 49 22];
  296.             app.UartsEditField.Value = 1;
  297.         end
  298.     end
  299.     methods (Access = public)
  300.         % Construct app
  301.         function app = app2
  302.             % Create and configure components
  303.             createComponents(app)
  304.             % Register the app with App Designer
  305.             registerApp(app, app.UIFigure)
  306.             % Execute the startup function
  307.             runStartupFcn(app, @startupFcn)
  308.             if nargout == 0
  309.                 clear app
  310.             end
  311.         end
  312.         % Code that executes before app deletion
  313.         function delete(app)
  314.             % Delete UIFigure when app is deleted
  315.             delete(app.UIFigure)
  316.         end
  317.     end
  318. end
复制代码
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:595122 发表于 2019-9-7 14:54 | 只看该作者
楼主有头文件吗 那个math~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表