MATLAB Serialport , sending data to 8051

2 ビュー (過去 30 日間)
Igor Shtein
Igor Shtein 2023 年 1 月 10 日
コメント済み: Igor Shtein 2023 年 2 月 23 日
Hi, I have connected my 8051 board via USB as Serialport ("COM5") to MATLAB R2022b v3.
8051 doesn't receive a simple data , but seems trying to receive something.
MATLAB has recognized a COM for communication.
  1. I know how to send a data to Arduino via serial and its work .
  2. The 8051 dev board is working well .
  3. I have send data via some serial terminals (visual studio ) and other to 8051 and they communicate correctly.
  4. When i try to send a data to 8051 all others terminals are turned off.
  5. I have read ALL documentation about serialport and it is helpfuless
  6. Also i tried to send data via Serial Explorer but with the same result (with Arduino it works)
  7. Communicational parameters are 9600,no parity , 1 stop bit , no hardware,8 bits data
  8. Instrument toolbox is installed
thanks for any help
some code :
ports = serialportlist;
disp(ports);
d = serialport("COM5", 9600);
pause(1);
writeline(d,"1");
pause(1);
write(d,"0x31","char");
pause(1);
clear device d

回答 (1 件)

Dhruv
Dhruv 2023 年 2 月 23 日
I understand that you are trying to communicate with 8051 board via USB Serialport through MATLAB. In order to assist you better, please send me the following information:
1. Can you please elaborate more on your workflow and what are you trying to achieve in your workflow.
2. Are you facing any specific issue while trying to implement your workflow, as an issue with a particular function in MATLAB or something similar.
I am looking forward to getting this information from you.
However, It is recommended that you attempt the following troubleshooting steps in order to potentially resolve the issue.
• Try checking if there are any conflicts between MATLAB and the other serial terminals that you've used to communicate with the 8051 board. It's possible that another program may be blocking the COM port and thus preventing MATLAB from communicating with the board.
• Use the MATLAB Instrument Control Toolbox to monitor the serial communication between MATLAB and the 8051 board. You can use the 'configureTerminator' method which can help you identify any issues with the data format or timing.
• Try sending a different message or sequence of messages to the 8051 board to see if it responds.
• Check if there are any errors or warnings in the MATLAB command window or log files that may help troubleshooting.
Hopefully, these suggestions will help solve the issue, if it still persists feel free to provide more information about the specific error that may be encountered and I will be happy to assist you further.
  1 件のコメント
Igor Shtein
Igor Shtein 2023 年 2 月 23 日
Hi thanks for your response , yesterday I have solved this problem , solution was DTR setting which is ON by default in MATLAB and OFF by default in other terminal programs.
I have turn DTR off and communication start working.
With the best regards and thanks for response.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSerial and USB Communication についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by