Home > other >  How to use MATLAB transmit data to the microcontroller and display the data on the screen
How to use MATLAB transmit data to the microcontroller and display the data on the screen

Time:11-06

We need a program, course design of matlab to design a data transfer single chip microcomputer, and then display the data on the screen, the key program how to write, and can give a type case?

CodePudding user response:

Class of the serial port of call function, realizes the serial port and single-chip microcomputer communication, single chip microcomputer to serial data to display

CodePudding user response:

S=serial (' COM4 ', 'BaudRate, 38400,' DataBits, 8, 'Terminator', 'CR/LF);
Fopen (s);
I=1;
Adc_size=8192;
Adc_data=https://bbs.csdn.net/topics/zeros (1, adc_size);
While (1)
Ser_data=https://bbs.csdn.net/topics/fscanf (s, '% s');
Adc_data (I)=str2double (ser_data);
Fprintf (% d \ 'n', I);
I=I + 1;
.
end

CodePudding user response:

refer to the second floor liuyinggui163 response:
s=serial (' COM4 ', 'BaudRate, 38400,' DataBits, 8, 'Terminator', 'CR/LF);
Fopen (s);
I=1;
Adc_size=8192;
Adc_data=https://bbs.csdn.net/topics/zeros (1, adc_size);
While (1)
Ser_data=https://bbs.csdn.net/topics/fscanf (s, '% s');
Adc_data (I)=str2double (ser_data);
Fprintf (% d \ 'n', I);
I=I + 1;
.
End

Please write the function mian completely white, very thank you for your answer,
  • Related